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 
42  public OptimizeVar(Solver s, boolean maximize, IntVar a, long step) {
43  this(mainJNI.new_OptimizeVar(Solver.getCPtr(s), s, maximize, IntVar.getCPtr(a), a, step), true);
44  }
45 
49  public long best() {
50  return mainJNI.OptimizeVar_best(swigCPtr, this);
51  }
52 
56  public IntVar var() {
57  long cPtr = mainJNI.OptimizeVar_var(swigCPtr, this);
58  return (cPtr == 0) ? null : new IntVar(cPtr, false);
59  }
60 
64  public boolean acceptDelta(Assignment delta, Assignment deltadelta) {
65  return mainJNI.OptimizeVar_acceptDelta(swigCPtr, this, Assignment.getCPtr(delta), delta, Assignment.getCPtr(deltadelta), deltadelta);
66  }
67 
68  public void enterSearch() {
69  mainJNI.OptimizeVar_enterSearch(swigCPtr, this);
70  }
71 
73  mainJNI.OptimizeVar_beginNextDecision(swigCPtr, this, DecisionBuilder.getCPtr(db), db);
74  }
75 
76  public void refuteDecision(Decision d) {
77  mainJNI.OptimizeVar_refuteDecision(swigCPtr, this, Decision.getCPtr(d), d);
78  }
79 
80  public boolean atSolution() {
81  return mainJNI.OptimizeVar_atSolution(swigCPtr, this);
82  }
83 
84  public boolean acceptSolution() {
85  return mainJNI.OptimizeVar_acceptSolution(swigCPtr, this);
86  }
87 
88  public String print() {
89  return mainJNI.OptimizeVar_print(swigCPtr, this);
90  }
91 
92  public String toString() {
93  return mainJNI.OptimizeVar_toString(swigCPtr, this);
94  }
95 
96  public void accept(ModelVisitor visitor) {
97  mainJNI.OptimizeVar_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
98  }
99 
100  public void applyBound() {
101  mainJNI.OptimizeVar_applyBound(swigCPtr, this);
102  }
103 
104 }
This class encapsulates an objective.
Model visitor.
void applyBound()
The class IntVar is a subset of IntExpr.
long best()
Returns the best value found during search.
A DecisionBuilder is responsible for creating the search tree.
void accept(ModelVisitor visitor)
Accepts the given model visitor.
OptimizeVar(long cPtr, boolean cMemoryOwn)
void enterSearch()
Beginning of the search.
String print()
boolean atSolution()
This method is called when a valid solution is found.
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: Assignment.java:14
A Decision represents a choice point in the search tree.
Definition: Decision.java:14
String toString()
A search monitor is a simple set of callbacks to monitor all search events.
boolean acceptSolution()
This method is called when a solution is found.
void refuteDecision(Decision d)
Before refuting the decision.
OptimizeVar(Solver s, boolean maximize, IntVar a, long step)
IntVar var()
Returns the variable that is optimized.
void beginNextDecision(DecisionBuilder db)
Before calling DecisionBuilder::Next.
boolean acceptDelta(Assignment delta, Assignment deltadelta)
Internal methods.
Solver Class A solver represents the main computation engine.
Definition: Solver.java:57