Callbacks
More information can be found in the Callbacks section of the manual.
Macros
JuMP.@build_constraint
— Macro@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))
Callback variable primal
JuMP.callback_value
— Functioncallback_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.
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.
Callback node status
JuMP.callback_node_status
— Functioncallback_node_status(cb_data, model::Model)
Return an MOI.CallbackNodeStatusCode
enum, indicating if the current primal solution available from callback_value
is integer feasible.