Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
MPObjective.java
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (https://www.swig.org).
3 * Version 4.2.1
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
9package com.google.ortools.linearsolver;
10
11import java.lang.reflect.*;
12
16public 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 protected static long swigRelease(MPObjective obj) {
30 long ptr = 0;
31 if (obj != null) {
32 if (!obj.swigCMemOwn)
33 throw new RuntimeException("Cannot release ownership as memory is not owned");
34 ptr = obj.swigCPtr;
35 obj.swigCMemOwn = false;
36 obj.delete();
37 }
38 return ptr;
39 }
40
41 @SuppressWarnings({"deprecation", "removal"})
42 protected void finalize() {
43 delete();
44 }
45
46 public synchronized void delete() {
47 if (swigCPtr != 0) {
48 if (swigCMemOwn) {
49 swigCMemOwn = false;
50 mainJNI.delete_MPObjective(swigCPtr);
51 }
52 swigCPtr = 0;
53 }
54 }
55
60 public void clear() {
61 mainJNI.MPObjective_clear(swigCPtr, this);
62 }
63
70 public void setCoefficient(MPVariable var, double coeff) {
71 mainJNI.MPObjective_setCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var, coeff);
72 }
73
79 public double getCoefficient(MPVariable var) {
80 return mainJNI.MPObjective_getCoefficient(swigCPtr, this, MPVariable.getCPtr(var), var);
81 }
82
86 public void setOffset(double value) {
87 mainJNI.MPObjective_setOffset(swigCPtr, this, value);
88 }
89
93 public double offset() {
94 return mainJNI.MPObjective_offset(swigCPtr, this);
95 }
96
100 public void setOptimizationDirection(boolean maximize) {
101 mainJNI.MPObjective_setOptimizationDirection(swigCPtr, this, maximize);
102 }
103
107 public void setMinimization() {
108 mainJNI.MPObjective_setMinimization(swigCPtr, this);
109 }
110
114 public void setMaximization() {
115 mainJNI.MPObjective_setMaximization(swigCPtr, this);
116 }
117
121 public boolean maximization() {
122 return mainJNI.MPObjective_maximization(swigCPtr, this);
123 }
124
128 public boolean minimization() {
129 return mainJNI.MPObjective_minimization(swigCPtr, this);
130 }
131
143 public double value() {
144 return mainJNI.MPObjective_value(swigCPtr, this);
145 }
146
153 public double bestBound() {
154 return mainJNI.MPObjective_bestBound(swigCPtr, this);
155 }
156
157}
MPObjective(long cPtr, boolean cMemoryOwn)
void setCoefficient(MPVariable var, double coeff)
static long swigRelease(MPObjective obj)
static long getCPtr(MPObjective obj)
static long getCPtr(MPVariable obj)