diff --git a/previews/PR158/Examples/benders/index.html b/previews/PR158/Examples/benders/index.html index 9e2f209..9711072 100644 --- a/previews/PR158/Examples/benders/index.html +++ b/previews/PR158/Examples/benders/index.html @@ -203,4 +203,4 @@ return best_sol[1] end

Run benders decomposition with POI

β2 = decomposed_model(; print_timer_outputs = false);
 GC.gc()
-β2 = decomposed_model();
+β2 = decomposed_model(); diff --git a/previews/PR158/Examples/example/index.html b/previews/PR158/Examples/example/index.html index d859b05..c1606ab 100644 --- a/previews/PR158/Examples/example/index.html +++ b/previews/PR158/Examples/example/index.html @@ -157,4 +157,4 @@ optimize!(model) isapprox(objective_value(model), 128/9, atol=1e-4) isapprox(value(x), 4/3, atol=1e-4) -isapprox(value(y), 4/3, atol=1e-4) +isapprox(value(y), 4/3, atol=1e-4) diff --git a/previews/PR158/Examples/markowitz/index.html b/previews/PR158/Examples/markowitz/index.html index ad6dcaa..c1aef37 100644 --- a/previews/PR158/Examples/markowitz/index.html +++ b/previews/PR158/Examples/markowitz/index.html @@ -62,4 +62,4 @@ end

Plot the efficient frontier

portfolios_values = sort(portfolios_values,by=x->x[1])
 portfolios_values_matrix = hcat([[v[1],v[2]] for v in values(portfolios_values)]...)'
 plot(portfolios_values_matrix[:,2],portfolios_values_matrix[:,1],legend=false,
-xlabel="Standard Deviation", ylabel = "Return", title = "Efficient Frontier")
+xlabel="Standard Deviation", ylabel = "Return", title = "Efficient Frontier") diff --git a/previews/PR158/index.html b/previews/PR158/index.html index a300d3f..09e2b04 100644 --- a/previews/PR158/index.html +++ b/previews/PR158/index.html @@ -1,2 +1,2 @@ -Home · ParametricOptInterface.jl
+Home · ParametricOptInterface.jl
diff --git a/previews/PR158/manual/index.html b/previews/PR158/manual/index.html index dd445c9..754002b 100644 --- a/previews/PR158/manual/index.html +++ b/previews/PR158/manual/index.html @@ -4,4 +4,4 @@ const POI = ParametricOptInterface const MOI = MathOptInterface # Define a Optimizer on top of the MOI optimizer -optimizer = POI.Optimizer(HiGHS.Optimizer())

Parameters

A MOI.Parameter is a set used to define a variable with a fixed value that can be changed by the user. It is analogous to MOI.EqualTo, but can be used by special methods like the ones in this package to remove the fixed variable from the optimization problem. This permits the usage of multiplicative parameters in lienar models and might speedup solves since the number of variables is reduced.

Adding a new parameter to a model

To add a parameter to a model, we must use the MOI.add_constrained_variable() function, passing as its arguments the model and a MOI.Parameter with its given value:

y, cy = MOI.add_constrained_variable(optimizer, MOI.Parameter(0.0))

Changing the parameter value

To change a given parameter's value, access its VariableIndex and set it to the new value using the MOI.Parameter structure.

MOI.set(optimizer, POI.ParameterValue(), y, MOI.Parameter(2.0))

Retrieving the dual of a parameter

Given an optimized model, one can compute the dual associated to a parameter, as long as it is an additive term in the constraints or objective. One can do so by getting the MOI.ConstraintDual attribute of the parameter's MOI.ConstraintIndex:

MOI.get(optimizer, POI.ParameterDual(), y)
+optimizer = POI.Optimizer(HiGHS.Optimizer())

Parameters

A MOI.Parameter is a set used to define a variable with a fixed value that can be changed by the user. It is analogous to MOI.EqualTo, but can be used by special methods like the ones in this package to remove the fixed variable from the optimization problem. This permits the usage of multiplicative parameters in lienar models and might speedup solves since the number of variables is reduced.

Adding a new parameter to a model

To add a parameter to a model, we must use the MOI.add_constrained_variable() function, passing as its arguments the model and a MOI.Parameter with its given value:

y, cy = MOI.add_constrained_variable(optimizer, MOI.Parameter(0.0))

Changing the parameter value

To change a given parameter's value, access its VariableIndex and set it to the new value using the MOI.Parameter structure.

MOI.set(optimizer, POI.ParameterValue(), y, MOI.Parameter(2.0))

Retrieving the dual of a parameter

Given an optimized model, one can compute the dual associated to a parameter, as long as it is an additive term in the constraints or objective. One can do so by getting the MOI.ConstraintDual attribute of the parameter's MOI.ConstraintIndex:

MOI.get(optimizer, POI.ParameterDual(), y)
diff --git a/previews/PR158/reference/index.html b/previews/PR158/reference/index.html index f96b4c1..0d65307 100644 --- a/previews/PR158/reference/index.html +++ b/previews/PR158/reference/index.html @@ -1,6 +1,6 @@ Reference · ParametricOptInterface.jl

Reference

ParametricOptInterface.ConstraintsInterpretationType
ConstraintsInterpretation <: MOI.AbstractOptimizerAttribute

Attribute to define how POI.Optimizer should interpret constraints.

  • POI.ONLY_CONSTRAINTS: Only interpret ScalarAffineFunction constraints as linear constraints If an expression such as x >= p1 + p2 appears it will be trated like a new constraint. This is the default behaviour of POI.Optimizer

  • POI.ONLY_BOUNDS: Only interpret ScalarAffineFunction constraints as a variable bound. This is valid for constraints such as x >= p or x >= p1 + p2. If a constraint x1 + x2 >= p appears, which is not a valid variable bound it will throw an error.

  • POI.BOUNDS_AND_CONSTRAINTS: Interpret ScalarAffineFunction constraints as a variable bound if they are a valid variable bound, i.e., x >= p or x >= p1 + p2 and interpret them as linear constraints otherwise.

Example

MOI.set(model, POI.InterpretConstraintsAsBounds(), POI.ONLY_BOUNDS)
 MOI.set(model, POI.InterpretConstraintsAsBounds(), POI.ONLY_CONSTRAINTS)
-MOI.set(model, POI.InterpretConstraintsAsBounds(), POI.BOUNDS_AND_CONSTRAINTS)
source
ParametricOptInterface.OptimizerType
Optimizer{T, OT <: MOI.ModelLike} <: MOI.AbstractOptimizer

Declares a Optimizer, which allows the handling of parameters in a optimization model.

Keyword arguments

  • evaluate_duals::Bool: If true, evaluates the dual of parameters. Users might want to set it to false to increase performance when the duals of parameters are not necessary. Defaults to true.

  • save_original_objective_and_constraints: If true saves the orginal function and set of the constraints as well as the original objective function inside POI.Optimizer. This is useful for printing the model but greatly increases the memory footprint. Users might want to set it to false to increase performance in applications where you don't need to query the original expressions provided to the model in constraints or in the objective. Note that this might break printing or queries such as MOI.get(model, MOI.ConstraintFunction(), c). Defaults to true.

Example

julia> ParametricOptInterface.Optimizer(GLPK.Optimizer())
-ParametricOptInterface.Optimizer{Float64,GLPK.Optimizer}
source
ParametricOptInterface.ParameterValueType
ParameterValue <: MOI.AbstractVariableAttribute

Attribute defined to set and get parameter values

Example

MOI.set(model, POI.ParameterValue(), p, 2.0)
-MOI.get(model, POI.ParameterValue(), p)
source
+MOI.set(model, POI.InterpretConstraintsAsBounds(), POI.BOUNDS_AND_CONSTRAINTS)source
ParametricOptInterface.OptimizerType
Optimizer{T, OT <: MOI.ModelLike} <: MOI.AbstractOptimizer

Declares a Optimizer, which allows the handling of parameters in a optimization model.

Keyword arguments

  • evaluate_duals::Bool: If true, evaluates the dual of parameters. Users might want to set it to false to increase performance when the duals of parameters are not necessary. Defaults to true.

  • save_original_objective_and_constraints: If true saves the orginal function and set of the constraints as well as the original objective function inside POI.Optimizer. This is useful for printing the model but greatly increases the memory footprint. Users might want to set it to false to increase performance in applications where you don't need to query the original expressions provided to the model in constraints or in the objective. Note that this might break printing or queries such as MOI.get(model, MOI.ConstraintFunction(), c). Defaults to true.

Example

julia> ParametricOptInterface.Optimizer(GLPK.Optimizer())
+ParametricOptInterface.Optimizer{Float64,GLPK.Optimizer}
source
ParametricOptInterface.ParameterDualType
ParameterDual <: MOI.AbstractVariableAttribute

Attribute defined to get the dual values associated to parameters

Example

MOI.get(model, POI.ParameterValue(), p)
source
ParametricOptInterface.ParameterValueType
ParameterValue <: MOI.AbstractVariableAttribute

Attribute defined to set and get parameter values

Example

MOI.set(model, POI.ParameterValue(), p, 2.0)
+MOI.get(model, POI.ParameterValue(), p)
source
diff --git a/previews/PR158/search/index.html b/previews/PR158/search/index.html index f431667..922ab8b 100644 --- a/previews/PR158/search/index.html +++ b/previews/PR158/search/index.html @@ -1,2 +1,2 @@ -Search · ParametricOptInterface.jl

Loading search...

    +Search · ParametricOptInterface.jl

    Loading search...