C++ Reference: class MPObjective

This documentation is automatically generated.

A class to express a linear objective.
Method
AddLinearExpr

Return type: void

Arguments: const LinearExpr& linear_expr

Adds linear_expr to the current objective, does not change the direction.

BestBound

Return type: double

Clear

Return type: void

GetCoefficient

Return type: double

Arguments: const MPVariable* const var

maximization

Return type: bool

Is the optimization direction set to maximize?

MaximizeLinearExpr

Return type: void

Arguments: const LinearExpr& linear_expr

Resets the current objective to maximize linear_expr.

minimization

Return type: bool

Is the optimization direction set to minimize?

MinimizeLinearExpr

Return type: void

Arguments: const LinearExpr& linear_expr

Resets the current objective to minimize linear_expr.

offset

Return type: double

Gets the constant term in the objective.

OptimizeLinearExpr

Return type: void

Arguments: const LinearExpr& linear_expr, bool is_maximization

SetCoefficient

Return type: void

Arguments: const MPVariable* const var, double coeff

SetMaximization

Return type: void

Sets the optimization direction to maximize.

SetMinimization

Return type: void

Sets the optimization direction to minimize.

SetOffset

Return type: void

Arguments: double value

Sets the constant term in the objective.

SetOptimizationDirection

Return type: void

Arguments: bool maximize

Sets the optimization direction (maximize: true or minimize: false).

terms

Return type: const absl::flat_hash_map<const MPVariable*, double>&

Value

Return type: double