Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ObjectiveMonitor.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
11public class ObjectiveMonitor extends SearchMonitor {
12 private transient long swigCPtr;
13
14 protected ObjectiveMonitor(long cPtr, boolean cMemoryOwn) {
15 super(mainJNI.ObjectiveMonitor_SWIGUpcast(cPtr), cMemoryOwn);
16 swigCPtr = cPtr;
17 }
18
19 protected static long getCPtr(ObjectiveMonitor obj) {
20 return (obj == null) ? 0 : obj.swigCPtr;
21 }
22
23 protected static long swigRelease(ObjectiveMonitor obj) {
24 long ptr = 0;
25 if (obj != null) {
26 if (!obj.swigCMemOwn)
27 throw new RuntimeException("Cannot release ownership as memory is not owned");
28 ptr = obj.swigCPtr;
29 obj.swigCMemOwn = false;
30 obj.delete();
31 }
32 return ptr;
33 }
34
35 @SuppressWarnings({"deprecation", "removal"})
36 protected void finalize() {
37 delete();
38 }
39
40 public synchronized void delete() {
41 if (swigCPtr != 0) {
42 if (swigCMemOwn) {
43 swigCMemOwn = false;
44 mainJNI.delete_ObjectiveMonitor(swigCPtr);
45 }
46 swigCPtr = 0;
47 }
48 super.delete();
49 }
50
51 public ObjectiveMonitor(Solver solver, SWIGTYPE_p_std__vectorT_bool_t maximize, IntVar[] vars, long[] steps) {
52 this(mainJNI.new_ObjectiveMonitor(Solver.getCPtr(solver), solver, SWIGTYPE_p_std__vectorT_bool_t.getCPtr(maximize), vars, steps), true);
53 }
54
55 public IntVar ObjectiveVar(int index) {
56 long cPtr = mainJNI.ObjectiveMonitor_ObjectiveVar(swigCPtr, this, index);
57 return (cPtr == 0) ? null : new IntVar(cPtr, false);
58 }
59
60 public IntVar MinimizationVar(int index) {
61 long cPtr = mainJNI.ObjectiveMonitor_MinimizationVar(swigCPtr, this, index);
62 return (cPtr == 0) ? null : new IntVar(cPtr, false);
63 }
64
65 public long Step(int index) {
66 return mainJNI.ObjectiveMonitor_Step(swigCPtr, this, index);
67 }
68
69 public boolean Maximize(int index) {
70 return mainJNI.ObjectiveMonitor_Maximize(swigCPtr, this, index);
71 }
72
73 public long BestValue(int index) {
74 return mainJNI.ObjectiveMonitor_BestValue(swigCPtr, this, index);
75 }
76
77 public int Size() {
78 return mainJNI.ObjectiveMonitor_Size(swigCPtr, this);
79 }
80
81 public void enterSearch() {
82 mainJNI.ObjectiveMonitor_enterSearch(swigCPtr, this);
83 }
84
85 public boolean atSolution() {
86 return mainJNI.ObjectiveMonitor_atSolution(swigCPtr, this);
87 }
88
89 public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
90 return mainJNI.ObjectiveMonitor_acceptDelta(swigCPtr, this, Assignment.getCPtr(delta), delta, Assignment.getCPtr(deltadelta), deltadelta);
91 }
92
93 public void accept(ModelVisitor visitor) {
94 mainJNI.ObjectiveMonitor_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
95 }
96
97}
ObjectiveMonitor(Solver solver, SWIGTYPE_p_std__vectorT_bool_t maximize, IntVar[] vars, long[] steps)
boolean acceptDelta(Assignment delta, Assignment deltadelta)