Java Reference

Java Reference

OptimizeVar.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
9package com.google.ortools.constraintsolver;
10
16public class OptimizeVar extends SearchMonitor {
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 @SuppressWarnings("deprecation")
29 protected void finalize() {
30 delete();
31 }
32
33 public synchronized void delete() {
34 if (swigCPtr != 0) {
35 if (swigCMemOwn) {
36 swigCMemOwn = false;
37 mainJNI.delete_OptimizeVar(swigCPtr);
38 }
39 swigCPtr = 0;
40 }
41 super.delete();
42 }
43
44 public OptimizeVar(Solver s, boolean maximize, IntVar a, long step) {
45 this(mainJNI.new_OptimizeVar(Solver.getCPtr(s), s, maximize, IntVar.getCPtr(a), a, step), true);
46 }
47
51 public long best() {
52 return mainJNI.OptimizeVar_best(swigCPtr, this);
53 }
54
58 public IntVar var() {
59 long cPtr = mainJNI.OptimizeVar_var(swigCPtr, this);
60 return (cPtr == 0) ? null : new IntVar(cPtr, false);
61 }
62
66 public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
67 return mainJNI.OptimizeVar_acceptDelta(swigCPtr, this, Assignment.getCPtr(delta), delta, Assignment.getCPtr(deltadelta), deltadelta);
68 }
69
70 public void enterSearch() {
71 mainJNI.OptimizeVar_enterSearch(swigCPtr, this);
72 }
73
75 mainJNI.OptimizeVar_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(db), db);
76 }
77
78 public void refuteDecision(Decision d) {
79 mainJNI.OptimizeVar_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d);
80 }
81
82 public boolean atSolution() {
83 return mainJNI.OptimizeVar_atSolution(swigCPtr, this);
84 }
85
86 public boolean acceptSolution() {
87 return mainJNI.OptimizeVar_acceptSolution(swigCPtr, this);
88 }
89
90 public String print() {
91 return mainJNI.OptimizeVar_print(swigCPtr, this);
92 }
93
94 public String toString() {
95 return mainJNI.OptimizeVar_toString(swigCPtr, this);
96 }
97
98 public void accept(ModelVisitor visitor) {
99 mainJNI.OptimizeVar_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
100 }
101
102 public void applyBound() {
103 mainJNI.OptimizeVar_applyBound(swigCPtr, this);
104 }
105
106}
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:15
A DecisionBuilder is responsible for creating the search tree.
A Decision represents a choice point in the search tree.
Definition: Decision.java:15
This class encapsulates an objective.
void enterSearch()
Beginning of the search.
boolean acceptSolution()
This method is called when a solution is found.
void refuteDecision(Decision d)
Before refuting the decision.
boolean acceptDelta(Assignment delta, Assignment deltadelta)
Internal methods.
OptimizeVar(Solver s, boolean maximize, IntVar a, long step)
boolean atSolution()
This method is called when a valid solution is found.
long best()
Returns the best value found during search.
IntVar var()
Returns the variable that is optimized.
OptimizeVar(long cPtr, boolean cMemoryOwn)
void beginNextDecision(DecisionBuilder db)
Before calling DecisionBuilder::Next.
void accept(ModelVisitor visitor)
Accepts the given model visitor.
A search monitor is a simple set of callbacks to monitor all search events.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:73