Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
OptimizeVar.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.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
9package com.google.ortools.constraintsolver;
10
16public class OptimizeVar extends ObjectiveMonitor {
17 private transient long swigCPtr;
18
19 protected OptimizeVar(long cPtr, boolean cMemoryOwn) {
20 super(mainJNI.OptimizeVar_SWIGUpcast(cPtr), cMemoryOwn);
21 swigCPtr = cPtr;
22 }
23
24 protected static long getCPtr(OptimizeVar obj) {
25 return (obj == null) ? 0 : obj.swigCPtr;
26 }
27
28 protected static long swigRelease(OptimizeVar obj) {
29 long ptr = 0;
30 if (obj != null) {
31 if (!obj.swigCMemOwn)
32 throw new RuntimeException("Cannot release ownership as memory is not owned");
33 ptr = obj.swigCPtr;
34 obj.swigCMemOwn = false;
35 obj.delete();
36 }
37 return ptr;
38 }
39
40 @SuppressWarnings({"deprecation", "removal"})
41 protected void finalize() {
42 delete();
43 }
44
45 public synchronized void delete() {
46 if (swigCPtr != 0) {
47 if (swigCMemOwn) {
48 swigCMemOwn = false;
49 mainJNI.delete_OptimizeVar(swigCPtr);
50 }
51 swigCPtr = 0;
52 }
53 super.delete();
54 }
55
57
58 public OptimizeVar(Solver solver, boolean maximize, IntVar var, long step) {
59 this(mainJNI.new_OptimizeVar__SWIG_0(Solver.getCPtr(solver), solver, maximize, IntVar.getCPtr(var), var, step), true);
60 }
61
62 public OptimizeVar(Solver solver, SWIGTYPE_p_std__vectorT_bool_t maximize, IntVar[] vars, long[] steps) {
63 this(mainJNI.new_OptimizeVar__SWIG_1(Solver.getCPtr(solver), solver, SWIGTYPE_p_std__vectorT_bool_t.getCPtr(maximize), vars, steps), true);
64 }
65
69 public long best() {
70 return mainJNI.OptimizeVar_best(swigCPtr, this);
71 }
72
76 public IntVar var() {
77 long cPtr = mainJNI.OptimizeVar_var(swigCPtr, this);
78 return (cPtr == 0) ? null : new IntVar(cPtr, false);
79 }
80
85 try {
86 mainJNI.OptimizeVar_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(db), db);
87 } finally {
89 }
90 }
91
92 public void refuteDecision(Decision d) {
93 mainJNI.OptimizeVar_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d);
94 }
95
96 public boolean atSolution() {
97 return mainJNI.OptimizeVar_atSolution(swigCPtr, this);
98 }
99
100 public boolean acceptSolution() {
101 return mainJNI.OptimizeVar_acceptSolution(swigCPtr, this);
102 }
103
104 public String Name() {
105 return mainJNI.OptimizeVar_Name(swigCPtr, this);
106 }
107
108 public String toString() {
109 return mainJNI.OptimizeVar_toString(swigCPtr, this);
110 }
111
112 public void applyBound() {
113 mainJNI.OptimizeVar_applyBound(swigCPtr, this);
114 }
115
116}
OptimizeVar(Solver solver, boolean maximize, IntVar var, long step)
OptimizeVar(Solver solver, SWIGTYPE_p_std__vectorT_bool_t maximize, IntVar[] vars, long[] steps)
OptimizeVar(long cPtr, boolean cMemoryOwn)