Create a new
Model, representing an optimization problem to be solved by the optimizer
Creating Decision variables
Create a new decision variable (
Variable) associated with the model.
Adding constraints and an objective function
Add a constraint to the model using operators
∈ may only be used for single variables with a right hand side that is one of:
x >= zeros(2) can be added to a model as follows:
julia> x = [Variable(model) for i = 1 : 2]; julia> @constraint(model, x >= zeros(2))
The constraint that variable
x should be an integer can be expressed using:
julia> @constraint(model, x ∈ ℤ)
Set the objective function of the model.
model be a
Model instance. The objective 'minimize x ⋅ x' can be added as follows:
julia> x = [Variable(model) for i = 1 : 2]; julia> @objective model Minimize x ⋅ x;
setobjective!(m, sense, expr)
Set the objective function and optimization sense (
Solve the model
m. (Re-)evaluate constraint and objective expressions, update the optimizer's internal representation of the problem, and start the optimization procedure.
Mark all parameters associated with the model as 'dirty' (out of date), meaning they must be updated upon their next evaluation.
Copy the problem to be solved to the optimizer.
Users should generally not need to call this function directly, as it is automatically called the first time
solve! is called on a
Re-evaluate the expressions used to build the constraints and objective function of
Users should generally not need to call this function directly, as it is automatically called in
Accessing solver results
Return the value of variable
x as determined by the optimizer.
Return the value of the objective function at the solution found by the optimizer.
Return the termination status of the solver.
Return information regarding the primal of the problem.
Return information regarding the dual of the problem.