Java Reference

Java Reference

MPVariable.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 MPVariable {
17  private transient long swigCPtr;
18  protected transient boolean swigCMemOwn;
19 
20  protected MPVariable(long cPtr, boolean cMemoryOwn) {
21  swigCMemOwn = cMemoryOwn;
22  swigCPtr = cPtr;
23  }
24 
25  protected static long getCPtr(MPVariable 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_MPVariable(swigCPtr);
39  }
40  swigCPtr = 0;
41  }
42  }
43 
47  public String name() {
48  return main_research_linear_solverJNI.MPVariable_name(swigCPtr, this);
49  }
50 
54  public void setInteger(boolean integer) {
55  main_research_linear_solverJNI.MPVariable_setInteger(swigCPtr, this, integer);
56  }
57 
65  public double solutionValue() {
66  return main_research_linear_solverJNI.MPVariable_solutionValue(swigCPtr, this);
67  }
68 
72  public int index() {
73  return main_research_linear_solverJNI.MPVariable_index(swigCPtr, this);
74  }
75 
79  public double lb() {
80  return main_research_linear_solverJNI.MPVariable_lb(swigCPtr, this);
81  }
82 
86  public double ub() {
87  return main_research_linear_solverJNI.MPVariable_ub(swigCPtr, this);
88  }
89 
93  public void setLb(double lb) {
94  main_research_linear_solverJNI.MPVariable_setLb(swigCPtr, this, lb);
95  }
96 
100  public void setUb(double ub) {
101  main_research_linear_solverJNI.MPVariable_setUb(swigCPtr, this, ub);
102  }
103 
107  public void setBounds(double lb, double ub) {
108  main_research_linear_solverJNI.MPVariable_setBounds(swigCPtr, this, lb, ub);
109  }
110 
115  public double reducedCost() {
116  return main_research_linear_solverJNI.MPVariable_reducedCost(swigCPtr, this);
117  }
118 
126  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPVariable_basisStatus(swigCPtr, this));
127  }
128 
129 }
double ub()
Returns the upper bound.
Definition: MPVariable.java:86
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
void setBounds(double lb, double ub)
Sets both the lower and upper bounds.
MPVariable(long cPtr, boolean cMemoryOwn)
Definition: MPVariable.java:20
double solutionValue()
Returns the value of the variable in the current solution.
Definition: MPVariable.java:65
double reducedCost()
Advanced usage: returns the reduced cost of the variable in the current solution (only available for...
String name()
Returns the name of the variable.
Definition: MPVariable.java:47
double lb()
Returns the lower bound.
Definition: MPVariable.java:79
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the variable in the current solution (only available for...
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:703
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:714
void setLb(double lb)
Sets the lower bound.
Definition: MPVariable.java:93
void setInteger(boolean integer)
Sets the integrality requirement of the variable.
Definition: MPVariable.java:54
int index()
Returns the index of the variable in the MPSolver::variables_.
Definition: MPVariable.java:72
void setUb(double ub)
Sets the upper bound.