# 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

## Callback node status

MathOptInterface.CallbackNodeStatusCodeType
CallbackNodeStatusCode

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

Possible values are:

source