Methods
Dealing with MPCCs
MPCCLibrary.create_model
— Functioncreate_model(args...)
Returns a JuMP model using Ipopt as the optimization solver. args
are attributes taken by the Ipopt optimizer (e.g. print_level = 0
, linear_solver = "ma57"
, etc. A list of all possible options can be found at the Ipopt Documentation).
MPCCLibrary.solve_mpcc!
— Functionsolve_mpcc!(model, comp, plot_data = false, objective = :obj, args...)
Solves an MPCC problem defined in JuMP using the Ipopt solver.
model
is a JuMP model initialized Ipopt Optimizer and containing the MPCC problem; comp
is an array of pairs with the complementarity variables; plot_data
is a boolean that defines whether the function returns data with the algorithm progress; objective
is a symbol corresponding to the name of the JuMP expression that defines the objective function. args
are parameters used by the MPCC algorithm.
Returns 0 (if plot_data
is false) or the progress data from the algorithm (if plot_data
is true) if the problem converges, and -1 otherwise.
Note: Pairs in comp
can only contain single variables or linear expressions.
Auxiliary methods
Orthogonal collocation
Discretization method for handling dynamic optimization.
MPCCLibrary.collocation_mat
— Functioncollocation_mat(ncp = 3)
Returns the collocation matrix using ncp
Radau roots as collocation points.
Note: DEPRECATED
MPCCLibrary.collocation_matrix
— Functioncollocation_matrix(ncp = 3, method = "Radau")
Function for generating a collocation matrix using ncp
collocation points with method
roots.
Returns the collocation matrix.
Possible values are 1 to 5 for ncp
, and "Radau" and "Legendre" for method
.
Reference: Lorenz T. Biegler. Nonlinear programming: concepts, algorithms, and applications to chemical processes. Vol. 10. Siam, 2010 (Section 10.2).
Bilevel optimization
To formulate a bilevel optimization problem as a MPCC problem, we need to add the first order conditions of the inner problem as constraints of the outer optimization problem.
MPCCLibrary.set_bilevel_opt_problem!
— Functionset_bilevel_opt_problem!(model::Model, vars::Array{JuMP.VariableRef})
Takes model
, which is a JuMP model corresponding to the inner level problem that to be optimized with respect to vars
, an array of JuMP variables.
It modifies the model by adding variables corresponding to the multipliers of each constraint and the first order condition of the lagrangian.
Returns an array with pairs of expressions and multipliers that must meet the complementarity condition.
Note: So far, it can only handle constraints of the form c(x) >= 0 and c(x) = 0, where c(x) is linear or quadratic.