diff --git a/previews/PR143/Examples/benders/index.html b/previews/PR143/Examples/benders/index.html index a3faa22..c047cb6 100644 --- a/previews/PR143/Examples/benders/index.html +++ b/previews/PR143/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/PR143/Examples/example/index.html b/previews/PR143/Examples/example/index.html index e5bad23..0f32dbd 100644 --- a/previews/PR143/Examples/example/index.html +++ b/previews/PR143/Examples/example/index.html @@ -186,4 +186,4 @@ @variable(model, z in MOI.Parameter(10)) MOI.set(model, POI.ConstraintsInterpretation(), POI.ONLY_BOUNDS) @constraint(model, x >= z) -@NLobjective(model, Min, x^2)

This use case should help users diminsh the time of making model modifications and re-solve the model. To increase the performance users that are familiar with JuMP direct mode can also use it.

+@NLobjective(model, Min, x^2)

This use case should help users diminsh the time of making model modifications and re-solve the model. To increase the performance users that are familiar with JuMP direct mode can also use it.

diff --git a/previews/PR143/Examples/markowitz/index.html b/previews/PR143/Examples/markowitz/index.html index e5d6709..99f2df0 100644 --- a/previews/PR143/Examples/markowitz/index.html +++ b/previews/PR143/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/PR143/index.html b/previews/PR143/index.html index 687a916..454fc34 100644 --- a/previews/PR143/index.html +++ b/previews/PR143/index.html @@ -1,2 +1,2 @@ -Home · ParametricOptInterface.jl
+Home · ParametricOptInterface.jl
diff --git a/previews/PR143/manual/index.html b/previews/PR143/manual/index.html index 0e5ec85..cc6e1a1 100644 --- a/previews/PR143/manual/index.html +++ b/previews/PR143/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/PR143/reference/index.html b/previews/PR143/reference/index.html index d1391a4..f4fb57c 100644 --- a/previews/PR143/reference/index.html +++ b/previews/PR143/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/PR143/search/index.html b/previews/PR143/search/index.html index ab49618..a061d0a 100644 --- a/previews/PR143/search/index.html +++ b/previews/PR143/search/index.html @@ -1,2 +1,2 @@ -Search · ParametricOptInterface.jl

Loading search...

    +Search · ParametricOptInterface.jl

    Loading search...