Java Reference

Java Reference

MPConstraint.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.2
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 
18 public class MPConstraint {
19  private transient long swigCPtr;
20  protected transient boolean swigCMemOwn;
21 
22  protected MPConstraint(long cPtr, boolean cMemoryOwn) {
23  swigCMemOwn = cMemoryOwn;
24  swigCPtr = cPtr;
25  }
26 
27  protected static long getCPtr(MPConstraint obj) {
28  return (obj == null) ? 0 : obj.swigCPtr;
29  }
30 
31  @SuppressWarnings("deprecation")
32  protected void finalize() {
33  delete();
34  }
35 
36  public synchronized void delete() {
37  if (swigCPtr != 0) {
38  if (swigCMemOwn) {
39  swigCMemOwn = false;
40  main_research_linear_solverJNI.delete_MPConstraint(swigCPtr);
41  }
42  swigCPtr = 0;
43  }
44  }
45 
49  public String name() {
50  return main_research_linear_solverJNI.MPConstraint_name(swigCPtr, this);
51  }
52 
59  public void setCoefficient(MPVariable var, double coeff) {
60  main_research_linear_solverJNI.MPConstraint_setCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var, coeff);
61  }
62 
67  public double getCoefficient(MPVariable var) {
68  return main_research_linear_solverJNI.MPConstraint_getCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var);
69  }
70 
74  public double lb() {
75  return main_research_linear_solverJNI.MPConstraint_lb(swigCPtr, this);
76  }
77 
81  public double ub() {
82  return main_research_linear_solverJNI.MPConstraint_ub(swigCPtr, this);
83  }
84 
88  public void setLb(double lb) {
89  main_research_linear_solverJNI.MPConstraint_setLb(swigCPtr, this, lb);
90  }
91 
95  public void setUb(double ub) {
96  main_research_linear_solverJNI.MPConstraint_setUb(swigCPtr, this, ub);
97  }
98 
102  public void setBounds(double lb, double ub) {
103  main_research_linear_solverJNI.MPConstraint_setBounds(swigCPtr, this, lb, ub);
104  }
105 
109  public boolean isLazy() {
110  return main_research_linear_solverJNI.MPConstraint_isLazy(swigCPtr, this);
111  }
112 
126  public void setIsLazy(boolean laziness) {
127  main_research_linear_solverJNI.MPConstraint_setIsLazy(swigCPtr, this, laziness);
128  }
129 
133  public int index() {
134  return main_research_linear_solverJNI.MPConstraint_index(swigCPtr, this);
135  }
136 
141  public double dualValue() {
142  return main_research_linear_solverJNI.MPConstraint_dualValue(swigCPtr, this);
143  }
144 
158  return MPSolver.BasisStatus.swigToEnum(main_research_linear_solverJNI.MPConstraint_basisStatus(swigCPtr, this));
159  }
160 
161 }
The class for constraints of a Mathematical Programming (MP) model.
int index()
Returns the index of the constraint in the MPSolver::constraints_.
void setIsLazy(boolean laziness)
Advanced usage: sets the constraint "laziness".
double getCoefficient(MPVariable var)
Gets the coefficient of a given variable on the constraint (which is 0 if the variable does not appe...
double ub()
Returns the upper bound.
void setCoefficient(MPVariable var, double coeff)
Sets the coefficient of the variable on the constraint.
void setLb(double lb)
Sets the lower bound.
boolean isLazy()
Advanced usage: returns true if the constraint is "lazy" (see below).
MPConstraint(long cPtr, boolean cMemoryOwn)
MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the constraint.
void setUb(double ub)
Sets the upper bound.
double dualValue()
Advanced usage: returns the dual value of the constraint in the current solution (only available for...
double lb()
Returns the lower bound.
void setBounds(double lb, double ub)
Sets both the lower and upper bounds.
String name()
Returns the name of the constraint.
This mathematical programming (MP) solver class is the main class though which users build and solve...
Definition: MPSolver.java:17
The class for variables of a Mathematical Programming (MP) model.
Definition: MPVariable.java:16
Advanced usage: possible basis status values for a variable and the slack variable of a linear const...
Definition: MPSolver.java:739
static BasisStatus swigToEnum(int swigValue)
Definition: MPSolver.java:750