Java Reference

Java Reference

MPObjective

Detailed Description

A class to express a linear objective.

Definition at line 16 of file MPObjective.java.

Public Member Functions

synchronized void delete ()
 
void clear ()
 Clears the offset, all variables and coefficients, and the optimization
direction. More...
 
void setCoefficient (MPVariable var, double coeff)
 Sets the coefficient of the variable in the objective. More...
 
double getCoefficient (MPVariable var)
 Gets the coefficient of a given variable in the objective

It returns 0 if the variable does not appear in the objective). More...
 
void setOffset (double value)
 Sets the constant term in the objective. More...
 
double offset ()
 Gets the constant term in the objective. More...
 
void setOptimizationDirection (boolean maximize)
 Sets the optimization direction (maximize: true or minimize: false). More...
 
void setMinimization ()
 Sets the optimization direction to minimize. More...
 
void setMaximization ()
 Sets the optimization direction to maximize. More...
 
boolean maximization ()
 Is the optimization direction set to maximize? More...
 
boolean minimization ()
 Is the optimization direction set to minimize? More...
 
double value ()
 Returns the objective value of the best solution found so far. More...
 
double bestBound ()
 Returns the best objective bound. More...
 

Protected Member Functions

 MPObjective (long cPtr, boolean cMemoryOwn)
 

Constructor & Destructor Documentation

◆ MPObjective()

MPObjective ( long  cPtr,
boolean  cMemoryOwn 
)
inlineprotected

Definition at line 20 of file MPObjective.java.

Member Function Documentation

◆ bestBound()

double bestBound ( )
inline

Returns the best objective bound.



In case of minimization, it is a lower bound on the objective value of the
optimal integer solution. Only available for discrete problems.

Definition at line 141 of file MPObjective.java.

◆ clear()

void clear ( )
inline

Clears the offset, all variables and coefficients, and the optimization
direction.

Definition at line 48 of file MPObjective.java.

◆ delete()

synchronized void delete ( )
inline

Definition at line 34 of file MPObjective.java.

◆ getCoefficient()

double getCoefficient ( MPVariable  var)
inline

Gets the coefficient of a given variable in the objective

It returns 0 if the variable does not appear in the objective).

Definition at line 67 of file MPObjective.java.

◆ maximization()

boolean maximization ( )
inline

Is the optimization direction set to maximize?

Definition at line 109 of file MPObjective.java.

◆ minimization()

boolean minimization ( )
inline

Is the optimization direction set to minimize?

Definition at line 116 of file MPObjective.java.

◆ offset()

double offset ( )
inline

Gets the constant term in the objective.

Definition at line 81 of file MPObjective.java.

◆ setCoefficient()

void setCoefficient ( MPVariable  var,
double  coeff 
)
inline

Sets the coefficient of the variable in the objective.



If the variable does not belong to the solver, the function just returns,
or crashes in non-opt mode.

Definition at line 58 of file MPObjective.java.

◆ setMaximization()

void setMaximization ( )
inline

Sets the optimization direction to maximize.

Definition at line 102 of file MPObjective.java.

◆ setMinimization()

void setMinimization ( )
inline

Sets the optimization direction to minimize.

Definition at line 95 of file MPObjective.java.

◆ setOffset()

void setOffset ( double  value)
inline

Sets the constant term in the objective.

Definition at line 74 of file MPObjective.java.

◆ setOptimizationDirection()

void setOptimizationDirection ( boolean  maximize)
inline

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

Definition at line 88 of file MPObjective.java.

◆ value()

double value ( )
inline

Returns the objective value of the best solution found so far.



It is the optimal objective value if the problem has been solved to
optimality.

Note: the objective value may be slightly different than what you could
compute yourself using MPVariable::solution_value(); please use the
–verify_solution flag to gain confidence about the numerical stability of
your solution.

Definition at line 131 of file MPObjective.java.


The documentation for this class was generated from the following file: