Reference

C++

Python

DotNET

Java Documentation

Java Reference

MPObjective.java
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.0
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.linearsolver;
10 
11 import java.lang.reflect.*;
12 
16 public class MPObjective {
17  private transient long swigCPtr;
18  protected transient boolean swigCMemOwn;
19 
20  protected MPObjective(long cPtr, boolean cMemoryOwn) {
21  swigCMemOwn = cMemoryOwn;
22  swigCPtr = cPtr;
23  }
24 
25  protected static long getCPtr(MPObjective obj) {
26  return (obj == null) ? 0 : obj.swigCPtr;
27  }
28 
29  @SuppressWarnings("deprecation")
30  protected void finalize() {
31  delete();
32  }
33 
34  public synchronized void delete() {
35  if (swigCPtr != 0) {
36  if (swigCMemOwn) {
37  swigCMemOwn = false;
38  main_research_linear_solverJNI.delete_MPObjective(swigCPtr);
39  }
40  swigCPtr = 0;
41  }
42  }
43 
48  public void clear() {
49  main_research_linear_solverJNI.MPObjective_clear(swigCPtr, this);
50  }
51 
58  public void setCoefficient(MPVariable var, double coeff) {
59  main_research_linear_solverJNI.MPObjective_setCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var, coeff);
60  }
61 
67  public double getCoefficient(MPVariable var) {
68  return main_research_linear_solverJNI.MPObjective_getCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var);
69  }
70 
74  public void setOffset(double value) {
75  main_research_linear_solverJNI.MPObjective_setOffset(swigCPtr, this, value);
76  }
77 
81  public double offset() {
82  return main_research_linear_solverJNI.MPObjective_offset(swigCPtr, this);
83  }
84 
88  public void setOptimizationDirection(boolean maximize) {
89  main_research_linear_solverJNI.MPObjective_setOptimizationDirection(swigCPtr, this, maximize);
90  }
91 
95  public void setMinimization() {
96  main_research_linear_solverJNI.MPObjective_setMinimization(swigCPtr, this);
97  }
98 
102  public void setMaximization() {
103  main_research_linear_solverJNI.MPObjective_setMaximization(swigCPtr, this);
104  }
105 
109  public boolean maximization() {
110  return main_research_linear_solverJNI.MPObjective_maximization(swigCPtr, this);
111  }
112 
116  public boolean minimization() {
117  return main_research_linear_solverJNI.MPObjective_minimization(swigCPtr, this);
118  }
119 
131  public double value() {
132  return main_research_linear_solverJNI.MPObjective_value(swigCPtr, this);
133  }
134 
141  public double bestBound() {
142  return main_research_linear_solverJNI.MPObjective_bestBound(swigCPtr, this);
143  }
144 
145 }
boolean minimization()
Is the optimization direction set to minimize?
void setOptimizationDirection(boolean maximize)
Sets the optimization direction (maximize: true or minimize: false).
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
double offset()
Gets the constant term in the objective.
double value()
Returns the objective value of the best solution found so far.
void clear()
Clears the offset, all variables and coefficients, and the optimization direction.
void setCoefficient(MPVariable var, double coeff)
Sets the coefficient of the variable in the objective.
void setMaximization()
Sets the optimization direction to maximize.
A class to express a linear objective.
double bestBound()
Returns the best objective bound.
boolean maximization()
Is the optimization direction set to maximize?
void setMinimization()
Sets the optimization direction to minimize.
void setOffset(double value)
Sets the constant term in the objective.
MPObjective(long cPtr, boolean cMemoryOwn)
double getCoefficient(MPVariable var)
Gets the coefficient of a given variable in the objective It returns 0 if the variable does not ap...