Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.linearsolver.MPObjective Class Reference

Public Member Functions

synchronized void delete ()
 
void clear ()
 
void setCoefficient (MPVariable var, double coeff)
 
double getCoefficient (MPVariable var)
 
void setOffset (double value)
 
double offset ()
 
void setOptimizationDirection (boolean maximize)
 
void setMinimization ()
 
void setMaximization ()
 
boolean maximization ()
 
boolean minimization ()
 
double value ()
 
double bestBound ()
 

Protected Member Functions

 MPObjective (long cPtr, boolean cMemoryOwn)
 
void finalize ()
 

Static Protected Member Functions

static long getCPtr (MPObjective obj)
 
static long swigRelease (MPObjective obj)
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

A class to express a linear objective.

Definition at line 16 of file MPObjective.java.

Constructor & Destructor Documentation

◆ MPObjective()

com.google.ortools.linearsolver.MPObjective.MPObjective ( long cPtr,
boolean cMemoryOwn )
protected

Definition at line 20 of file MPObjective.java.

Member Function Documentation

◆ bestBound()

double com.google.ortools.linearsolver.MPObjective.bestBound ( )

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 153 of file MPObjective.java.

◆ clear()

void com.google.ortools.linearsolver.MPObjective.clear ( )

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

Definition at line 60 of file MPObjective.java.

◆ delete()

synchronized void com.google.ortools.linearsolver.MPObjective.delete ( )

Definition at line 46 of file MPObjective.java.

◆ finalize()

void com.google.ortools.linearsolver.MPObjective.finalize ( )
protected

Definition at line 42 of file MPObjective.java.

◆ getCoefficient()

double com.google.ortools.linearsolver.MPObjective.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).

Definition at line 79 of file MPObjective.java.

◆ getCPtr()

static long com.google.ortools.linearsolver.MPObjective.getCPtr ( MPObjective obj)
staticprotected

Definition at line 25 of file MPObjective.java.

◆ maximization()

boolean com.google.ortools.linearsolver.MPObjective.maximization ( )

Is the optimization direction set to maximize?

Definition at line 121 of file MPObjective.java.

◆ minimization()

boolean com.google.ortools.linearsolver.MPObjective.minimization ( )

Is the optimization direction set to minimize?

Definition at line 128 of file MPObjective.java.

◆ offset()

double com.google.ortools.linearsolver.MPObjective.offset ( )

Gets the constant term in the objective.

Definition at line 93 of file MPObjective.java.

◆ setCoefficient()

void com.google.ortools.linearsolver.MPObjective.setCoefficient ( MPVariable var,
double coeff )

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 70 of file MPObjective.java.

◆ setMaximization()

void com.google.ortools.linearsolver.MPObjective.setMaximization ( )

Sets the optimization direction to maximize.

Definition at line 114 of file MPObjective.java.

◆ setMinimization()

void com.google.ortools.linearsolver.MPObjective.setMinimization ( )

Sets the optimization direction to minimize.

Definition at line 107 of file MPObjective.java.

◆ setOffset()

void com.google.ortools.linearsolver.MPObjective.setOffset ( double value)

Sets the constant term in the objective.

Definition at line 86 of file MPObjective.java.

◆ setOptimizationDirection()

void com.google.ortools.linearsolver.MPObjective.setOptimizationDirection ( boolean maximize)

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

Definition at line 100 of file MPObjective.java.

◆ swigRelease()

static long com.google.ortools.linearsolver.MPObjective.swigRelease ( MPObjective obj)
staticprotected

Definition at line 29 of file MPObjective.java.

◆ value()

double com.google.ortools.linearsolver.MPObjective.value ( )

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 143 of file MPObjective.java.

Member Data Documentation

◆ swigCMemOwn

transient boolean com.google.ortools.linearsolver.MPObjective.swigCMemOwn
protected

Definition at line 18 of file MPObjective.java.


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