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.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 
9 package com.google.ortools.constraintsolver;
10 
14 public class OptimizeVar extends SearchMonitor {
15  private transient long swigCPtr;
16 
17  protected OptimizeVar(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.OptimizeVar_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(OptimizeVar obj) {
23  return (obj == null) ? 0 : obj.swigCPtr;
24  }
25 
26  @SuppressWarnings("deprecation")
27  protected void finalize() {
28  delete();
29  }
30 
31  public synchronized void delete() {
32  if (swigCPtr != 0) {
33  if (swigCMemOwn) {
34  swigCMemOwn = false;
35  mainJNI.delete_OptimizeVar(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
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  try {
76  mainJNI.OptimizeVar_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(db), db);
77  } finally {
79  }
80  }
81 
82  public void refuteDecision(Decision d) {
83  mainJNI.OptimizeVar_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d);
84  }
85 
86  public boolean atSolution() {
87  return mainJNI.OptimizeVar_atSolution(swigCPtr, this);
88  }
89 
90  public boolean acceptSolution() {
91  return mainJNI.OptimizeVar_acceptSolution(swigCPtr, this);
92  }
93 
94  public String print() {
95  return mainJNI.OptimizeVar_print(swigCPtr, this);
96  }
97 
98  public String toString() {
99  return mainJNI.OptimizeVar_toString(swigCPtr, this);
100  }
101 
102  public void accept(ModelVisitor visitor) {
103  mainJNI.OptimizeVar_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
104  }
105 
106  public void applyBound() {
107  mainJNI.OptimizeVar_applyBound(swigCPtr, this);
108  }
109 
110 }
Solver Class A solver represents the main computation engine.
Definition: Solver.java:60
A Decision represents a choice point in the search tree.
Definition: Decision.java:14
OptimizeVar(Solver s, boolean maximize, IntVar a, long step)
boolean acceptDelta(Assignment delta, Assignment deltadelta)
Internal methods.
IntVar var()
Returns the variable that is optimized.
void keepAliveDecisionBuilder(DecisionBuilder db)
A search monitor is a simple set of callbacks to monitor all search events.
A DecisionBuilder is responsible for creating the search tree.
This class encapsulates an objective.
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:14
OptimizeVar(long cPtr, boolean cMemoryOwn)
long best()
Returns the best value found during search.