Objectives

A technical manual for objective functions in InfiniteOpt. See the respective guide for more information.

Queries

JuMP.objective_senseMethod
JuMP.objective_sense(model::InfiniteModel)::MOI.OptimizationSense

Extend JuMP.objective_sense to return the objective sense of the infinite model model.

Example

julia> objective_sense(model)
MIN_SENSE::OptimizationSense = 0
source
JuMP.objective_function_typeMethod
JuMP.objective_function_type(model::InfiniteModel)::Type{<:JuMP.AbstractJuMPScalar}

Extend JuMP.objective_function_type to return the objective function type of infinite model model.

Example

julia> objective_function_type(model)
GenericAffExpr{Float64,GeneralVariableRef}
source
JuMP.objective_functionMethod
JuMP.objective_function(model::InfiniteModel)::JuMP.AbstractJuMPScalar

Extend JuMP.objective_function to return the objective of infinite model model.

Example

julia> objective_function(model)
1
source

Modification

JuMP.set_objective_functionMethod
JuMP.set_objective_function(model::InfiniteModel,
                            func::JuMP.AbstractJuMPScalar)::Nothing

Extend JuMP.set_objective_function to set the objective expression of infinite model model. Errors if func contains infinite variables and/or parameters. Also errors if func contains invalid variables.

Example

julia> set_objective_function(model, 2x + 1)

julia> objective_function(model)
2 x + 1
source
JuMP.set_objective_functionMethod
JuMP.set_objective_function(model::InfiniteModel, func::Real)::Nothing

Extend JuMP.set_objective_function to set the objective expression of model with a number.

Example

julia> set_objective_function(model, 3)

julia> objective_function(model)
3
source
JuMP.set_objective_senseMethod
JuMP.set_objective_sense(model::InfiniteModel,
                         sense::MOI.OptimizationSense)::Nothing

Extend JuMP.set_objective_sense to set the objective sense of infinite model model.

Example

julia> set_objective_sense(model, MOI.MIN_SENSE)

julia> objective_sense(model)
MIN_SENSE::OptimizationSense = 0
source
JuMP.set_objectiveMethod
JuMP.set_objective(model::InfiniteModel, sense::MOI.OptimizationSense,
                   func::Union{JuMP.AbstractJuMPScalar, Real})::Nothing

Extend JuMP.set_objective to set the objective of infinite model model. Errors if func contains infinite variables and/or parameters, or if it does not belong to the model.

Example

julia> set_objective(model, MOI.MIN_SENSE, 2x + 1)

julia> objective_function(model)
2 x + 1
source
JuMP.set_objective_coefficientMethod
JuMP.set_objective_coefficient(model::InfiniteModel,
                               variable::GeneralVariableRef,
                               coefficient::Real)::Nothing

Extend JuMP.set_objective_coefficient Set the linear objective coefficient associated with variable to coefficient. Errors if the function type is unsupported.

Example

julia> @variable(model, x)
x

julia> @variable(model, y)
y

julia> @objective(model, x + y)
x + y

julia> set_objective_coefficient(model, y, 2)

julia> objective_function(model)
x + 2 y
source