Callbacks

More information can be found in the Callbacks section of the manual.

Macros

JuMP.@build_constraintMacro
@build_constraint(constraint_expr)

Constructs a ScalarConstraint or VectorConstraint using the same machinery as @constraint but without adding the constraint to a model.

Constraints using broadcast operators like x .<= 1 are also supported and will create arrays of ScalarConstraint or VectorConstraint.

Examples

model = Model();
@variable(model, x);
@build_constraint(2x >= 1)

# output
ScalarConstraint{GenericAffExpr{Float64,VariableRef},MathOptInterface.GreaterThan{Float64}}(2 x, MathOptInterface.GreaterThan{Float64}(1.0))
source

Callback variable primal

JuMP.callback_valueFunction
callback_value(cb_data, x::VariableRef)

Return the primal solution of a variable inside a callback.

cb_data is the argument to the callback function, and the type is dependent on the solver.

source
callback_value(cb_data, expr::Union{GenericAffExpr, GenericQuadExpr})

Return the primal solution of an affine or quadratic expression inside a callback by getting the value for each variable appearing in the expression.

cb_data is the argument to the callback function, and the type is dependent on the solver.

source
MathOptInterface.CallbackVariablePrimalType
CallbackVariablePrimal(callback_data)

A variable attribute for the assignment to some primal variable's value during the callback identified by callback_data.

Callback node status

MathOptInterface.CallbackNodeStatusCodeType
CallbackNodeStatusCode

An Enum of possible return values from calling get with CallbackNodeStatus.

Possible values are:

  • CALLBACK_NODE_STATUS_INTEGER: the primal solution available from CallbackVariablePrimal is integer feasible.
  • CALLBACK_NODE_STATUS_FRACTIONAL: the primal solution available from CallbackVariablePrimal is integer infeasible.
  • CALLBACK_NODE_STATUS_UNKNOWN: the primal solution available from CallbackVariablePrimal might be integer feasible or infeasible.
source