Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
com.google.ortools.constraintsolver.BaseLns Class Reference
Inheritance diagram for com.google.ortools.constraintsolver.BaseLns:
com.google.ortools.constraintsolver.IntVarLocalSearchOperator com.google.ortools.constraintsolver.LocalSearchOperator com.google.ortools.constraintsolver.BaseObject

Public Member Functions

synchronized void delete ()
 
void swigReleaseOwnership ()
 
void swigTakeOwnership ()
 
 BaseLns (IntVar[] vars)
 
void initFragments ()
 
boolean nextFragment ()
 
void appendToFragment (int index)
 
int fragmentSize ()
 
boolean HasFragments ()
 
- Public Member Functions inherited from com.google.ortools.constraintsolver.IntVarLocalSearchOperator
 IntVarLocalSearchOperator (IntVar[] vars, boolean keep_inverse_values)
 
 IntVarLocalSearchOperator (IntVar[] vars)
 
boolean HoldsDelta ()
 
void start (Assignment assignment)
 
boolean isIncremental ()
 
int size ()
 
long value (long index)
 
IntVar var (long index)
 
boolean SkipUnchanged (int index)
 
long oldValue (long index)
 
long PrevValue (long index)
 
void setValue (long index, long value)
 
boolean activated (long index)
 
void activate (long index)
 
void deactivate (long index)
 
boolean ApplyChanges (Assignment delta, Assignment deltadelta)
 
void RevertChanges (boolean change_was_incremental)
 
void addVars (IntVar[] vars)
 
void onStart ()
 
- Public Member Functions inherited from com.google.ortools.constraintsolver.LocalSearchOperator
 LocalSearchOperator ()
 
boolean nextNeighbor (Assignment delta, Assignment deltadelta)
 
void reset ()
 
- Public Member Functions inherited from com.google.ortools.constraintsolver.BaseObject
 BaseObject ()
 
String toString ()
 

Protected Member Functions

 BaseLns (long cPtr, boolean cMemoryOwn)
 
void finalize ()
 
void swigDirectorDisconnect ()
 
- Protected Member Functions inherited from com.google.ortools.constraintsolver.IntVarLocalSearchOperator
 IntVarLocalSearchOperator (long cPtr, boolean cMemoryOwn)
 
boolean oneNeighbor ()
 
- Protected Member Functions inherited from com.google.ortools.constraintsolver.LocalSearchOperator
 LocalSearchOperator (long cPtr, boolean cMemoryOwn)
 
- Protected Member Functions inherited from com.google.ortools.constraintsolver.BaseObject
 BaseObject (long cPtr, boolean cMemoryOwn)
 

Static Protected Member Functions

static long getCPtr (BaseLns obj)
 
static long swigRelease (BaseLns obj)
 
- Static Protected Member Functions inherited from com.google.ortools.constraintsolver.IntVarLocalSearchOperator
static long getCPtr (IntVarLocalSearchOperator obj)
 
static long swigRelease (IntVarLocalSearchOperator obj)
 
- Static Protected Member Functions inherited from com.google.ortools.constraintsolver.LocalSearchOperator
static long getCPtr (LocalSearchOperator obj)
 
static long swigRelease (LocalSearchOperator obj)
 
- Static Protected Member Functions inherited from com.google.ortools.constraintsolver.BaseObject
static long getCPtr (BaseObject obj)
 
static long swigRelease (BaseObject obj)
 

Additional Inherited Members

- Protected Attributes inherited from com.google.ortools.constraintsolver.BaseObject
transient boolean swigCMemOwn
 

Detailed Description

This is the base class for building an Lns operator. An Lns fragment is a
collection of variables which will be relaxed. Fragments are built with
NextFragment(), which returns false if there are no more fragments to build.
Optionally one can override InitFragments, which is called from
LocalSearchOperator::Start to initialize fragment data.

Here's a sample relaxing one variable at a time:

class OneVarLns : public BaseLns {
public:
OneVarLns(const std::vector<IntVar*>& vars) : BaseLns(vars), index_(0) {}
virtual ~OneVarLns() {}
virtual void InitFragments() { index_ = 0; }
virtual bool NextFragment() {
const int size = Size();
if (index_ < size) {
AppendToFragment(index_);
++index_;
return true;
} else {
return false;
}
}

private:
int index_;
};

Definition at line 40 of file BaseLns.java.

Constructor & Destructor Documentation

◆ BaseLns() [1/2]

com.google.ortools.constraintsolver.BaseLns.BaseLns ( long cPtr,
boolean cMemoryOwn )
protected

Definition at line 43 of file BaseLns.java.

◆ BaseLns() [2/2]

com.google.ortools.constraintsolver.BaseLns.BaseLns ( IntVar[] vars)

Definition at line 95 of file BaseLns.java.

Member Function Documentation

◆ appendToFragment()

void com.google.ortools.constraintsolver.BaseLns.appendToFragment ( int index)

Definition at line 108 of file BaseLns.java.

◆ delete()

synchronized void com.google.ortools.constraintsolver.BaseLns.delete ( )

Reimplemented from com.google.ortools.constraintsolver.IntVarLocalSearchOperator.

Definition at line 69 of file BaseLns.java.

◆ finalize()

void com.google.ortools.constraintsolver.BaseLns.finalize ( )
protected

Reimplemented from com.google.ortools.constraintsolver.IntVarLocalSearchOperator.

Definition at line 65 of file BaseLns.java.

◆ fragmentSize()

int com.google.ortools.constraintsolver.BaseLns.fragmentSize ( )

Definition at line 112 of file BaseLns.java.

◆ getCPtr()

static long com.google.ortools.constraintsolver.BaseLns.getCPtr ( BaseLns obj)
staticprotected

Definition at line 48 of file BaseLns.java.

◆ HasFragments()

boolean com.google.ortools.constraintsolver.BaseLns.HasFragments ( )

Reimplemented from com.google.ortools.constraintsolver.LocalSearchOperator.

Definition at line 116 of file BaseLns.java.

◆ initFragments()

void com.google.ortools.constraintsolver.BaseLns.initFragments ( )

Definition at line 100 of file BaseLns.java.

◆ nextFragment()

boolean com.google.ortools.constraintsolver.BaseLns.nextFragment ( )

Definition at line 104 of file BaseLns.java.

◆ swigDirectorDisconnect()

void com.google.ortools.constraintsolver.BaseLns.swigDirectorDisconnect ( )
protected

Reimplemented from com.google.ortools.constraintsolver.IntVarLocalSearchOperator.

Definition at line 80 of file BaseLns.java.

◆ swigRelease()

static long com.google.ortools.constraintsolver.BaseLns.swigRelease ( BaseLns obj)
staticprotected

Definition at line 52 of file BaseLns.java.

◆ swigReleaseOwnership()

void com.google.ortools.constraintsolver.BaseLns.swigReleaseOwnership ( )

Reimplemented from com.google.ortools.constraintsolver.IntVarLocalSearchOperator.

Definition at line 85 of file BaseLns.java.

◆ swigTakeOwnership()

void com.google.ortools.constraintsolver.BaseLns.swigTakeOwnership ( )

Reimplemented from com.google.ortools.constraintsolver.IntVarLocalSearchOperator.

Definition at line 90 of file BaseLns.java.


The documentation for this class was generated from the following file: