C++ Reference

C++ Reference: Routing

Detailed Description

An Assignment is a variable -> domains mapping, used to report solutions to the user.

Definition at line 5081 of file constraint_solver.h.

Public Types

typedef AssignmentContainer< IntVar, IntVarElementIntContainer
 
typedef AssignmentContainer< IntervalVar, IntervalVarElementIntervalContainer
 
typedef AssignmentContainer< SequenceVar, SequenceVarElementSequenceContainer
 

Public Member Functions

 Assignment (Solver *const s)
 
 Assignment (const Assignment *const copy)
 
 ~Assignment () override
 
void Clear ()
 
bool Empty () const
 
int Size () const
 
int NumIntVars () const
 
int NumIntervalVars () const
 
int NumSequenceVars () const
 
void Store ()
 
void Restore ()
 
bool Load (const std::string &filename)
 Loads an assignment from a file; does not add variables to the assignment (only the variables contained in the assignment are modified). More...
 
bool Load (File *file)
 
void Load (const AssignmentProto &assignment_proto)
 #if !defined(SWIG) More...
 
bool Save (const std::string &filename) const
 Saves the assignment to a file. More...
 
bool Save (File *file) const
 
void Save (AssignmentProto *const assignment_proto) const
 
void AddObjective (IntVar *const v)
 
void ClearObjective ()
 
IntVarObjective () const
 
bool HasObjective () const
 
int64_t ObjectiveMin () const
 
int64_t ObjectiveMax () const
 
int64_t ObjectiveValue () const
 
bool ObjectiveBound () const
 
void SetObjectiveMin (int64_t m)
 
void SetObjectiveMax (int64_t m)
 
void SetObjectiveValue (int64_t value)
 
void SetObjectiveRange (int64_t l, int64_t u)
 
IntVarElementAdd (IntVar *const var)
 
void Add (const std::vector< IntVar * > &vars)
 
IntVarElementFastAdd (IntVar *const var)
 Adds without checking if variable has been previously added. More...
 
int64_t Min (const IntVar *const var) const
 
int64_t Max (const IntVar *const var) const
 
int64_t Value (const IntVar *const var) const
 
bool Bound (const IntVar *const var) const
 
void SetMin (const IntVar *const var, int64_t m)
 
void SetMax (const IntVar *const var, int64_t m)
 
void SetRange (const IntVar *const var, int64_t l, int64_t u)
 
void SetValue (const IntVar *const var, int64_t value)
 
IntervalVarElementAdd (IntervalVar *const var)
 
void Add (const std::vector< IntervalVar * > &vars)
 
IntervalVarElementFastAdd (IntervalVar *const var)
 Adds without checking if variable has been previously added. More...
 
int64_t StartMin (const IntervalVar *const var) const
 
int64_t StartMax (const IntervalVar *const var) const
 
int64_t StartValue (const IntervalVar *const var) const
 
int64_t DurationMin (const IntervalVar *const var) const
 
int64_t DurationMax (const IntervalVar *const var) const
 
int64_t DurationValue (const IntervalVar *const var) const
 
int64_t EndMin (const IntervalVar *const var) const
 
int64_t EndMax (const IntervalVar *const var) const
 
int64_t EndValue (const IntervalVar *const var) const
 
int64_t PerformedMin (const IntervalVar *const var) const
 
int64_t PerformedMax (const IntervalVar *const var) const
 
int64_t PerformedValue (const IntervalVar *const var) const
 
void SetStartMin (const IntervalVar *const var, int64_t m)
 
void SetStartMax (const IntervalVar *const var, int64_t m)
 
void SetStartRange (const IntervalVar *const var, int64_t mi, int64_t ma)
 
void SetStartValue (const IntervalVar *const var, int64_t value)
 
void SetDurationMin (const IntervalVar *const var, int64_t m)
 
void SetDurationMax (const IntervalVar *const var, int64_t m)
 
void SetDurationRange (const IntervalVar *const var, int64_t mi, int64_t ma)
 
void SetDurationValue (const IntervalVar *const var, int64_t value)
 
void SetEndMin (const IntervalVar *const var, int64_t m)
 
void SetEndMax (const IntervalVar *const var, int64_t m)
 
void SetEndRange (const IntervalVar *const var, int64_t mi, int64_t ma)
 
void SetEndValue (const IntervalVar *const var, int64_t value)
 
void SetPerformedMin (const IntervalVar *const var, int64_t m)
 
void SetPerformedMax (const IntervalVar *const var, int64_t m)
 
void SetPerformedRange (const IntervalVar *const var, int64_t mi, int64_t ma)
 
void SetPerformedValue (const IntervalVar *const var, int64_t value)
 
SequenceVarElementAdd (SequenceVar *const var)
 
void Add (const std::vector< SequenceVar * > &vars)
 
SequenceVarElementFastAdd (SequenceVar *const var)
 Adds without checking if the variable had been previously added. More...
 
const std::vector< int > & ForwardSequence (const SequenceVar *const var) const
 
const std::vector< int > & BackwardSequence (const SequenceVar *const var) const
 
const std::vector< int > & Unperformed (const SequenceVar *const var) const
 
void SetSequence (const SequenceVar *const var, const std::vector< int > &forward_sequence, const std::vector< int > &backward_sequence, const std::vector< int > &unperformed)
 
void SetForwardSequence (const SequenceVar *const var, const std::vector< int > &forward_sequence)
 
void SetBackwardSequence (const SequenceVar *const var, const std::vector< int > &backward_sequence)
 
void SetUnperformed (const SequenceVar *const var, const std::vector< int > &unperformed)
 
void Activate (const IntVar *const var)
 
void Deactivate (const IntVar *const var)
 
bool Activated (const IntVar *const var) const
 
void Activate (const IntervalVar *const var)
 
void Deactivate (const IntervalVar *const var)
 
bool Activated (const IntervalVar *const var) const
 
void Activate (const SequenceVar *const var)
 
void Deactivate (const SequenceVar *const var)
 
bool Activated (const SequenceVar *const var) const
 
void ActivateObjective ()
 
void DeactivateObjective ()
 
bool ActivatedObjective () const
 
std::string DebugString () const override
 
bool AreAllElementsBound () const
 
bool Contains (const IntVar *const var) const
 
bool Contains (const IntervalVar *const var) const
 
bool Contains (const SequenceVar *const var) const
 
void CopyIntersection (const Assignment *assignment)
 Copies the intersection of the two assignments to the current assignment. More...
 
void Copy (const Assignment *assignment)
 Copies 'assignment' to the current assignment, clearing its previous content. More...
 
const IntContainerIntVarContainer () const
 
IntContainerMutableIntVarContainer ()
 
const IntervalContainerIntervalVarContainer () const
 
IntervalContainerMutableIntervalVarContainer ()
 
const SequenceContainerSequenceVarContainer () const
 
SequenceContainerMutableSequenceVarContainer ()
 
bool operator== (const Assignment &assignment) const
 
bool operator!= (const Assignment &assignment) const
 
Solversolver () const
 
void FreezeQueue ()
 This method freezes the propagation queue. More...
 
void UnfreezeQueue ()
 This method unfreezes the propagation queue. More...
 
void EnqueueDelayedDemon (Demon *const d)
 This method pushes the demon onto the propagation queue. More...
 
void EnqueueVar (Demon *const d)
 
void ExecuteAll (const SimpleRevFIFO< Demon * > &demons)
 
void EnqueueAll (const SimpleRevFIFO< Demon * > &demons)
 
void set_action_on_fail (Solver::Action a)
 
void reset_action_on_fail ()
 This method clears the failure callback. More...
 
void set_variable_to_clean_on_fail (IntVar *v)
 Shortcut for variable cleaner. More...
 
virtual std::string name () const
 Object naming. More...
 
void set_name (const std::string &name)
 
bool HasName () const
 Returns whether the object has been named or not. More...
 
virtual std::string BaseName () const
 Returns a base name for automatic naming. More...
 

Member Typedef Documentation

◆ IntContainer

◆ IntervalContainer

◆ SequenceContainer

Constructor & Destructor Documentation

◆ Assignment() [1/2]

Assignment ( Solver *const  s)
explicit

◆ Assignment() [2/2]

Assignment ( const Assignment *const  copy)
explicit

◆ ~Assignment()

~Assignment ( )
override

Member Function Documentation

◆ Activate() [1/3]

void Activate ( const IntervalVar *const  var)

◆ Activate() [2/3]

void Activate ( const IntVar *const  var)

◆ Activate() [3/3]

void Activate ( const SequenceVar *const  var)

◆ Activated() [1/3]

bool Activated ( const IntervalVar *const  var) const

◆ Activated() [2/3]

bool Activated ( const IntVar *const  var) const

◆ Activated() [3/3]

bool Activated ( const SequenceVar *const  var) const

◆ ActivatedObjective()

bool ActivatedObjective ( ) const

◆ ActivateObjective()

void ActivateObjective ( )

◆ Add() [1/6]

void Add ( const std::vector< IntervalVar * > &  vars)

◆ Add() [2/6]

void Add ( const std::vector< IntVar * > &  vars)

◆ Add() [3/6]

void Add ( const std::vector< SequenceVar * > &  vars)

◆ Add() [4/6]

IntervalVarElement * Add ( IntervalVar *const  var)

◆ Add() [5/6]

IntVarElement * Add ( IntVar *const  var)

◆ Add() [6/6]

SequenceVarElement * Add ( SequenceVar *const  var)

◆ AddObjective()

void AddObjective ( IntVar *const  v)

◆ AreAllElementsBound()

bool AreAllElementsBound ( ) const
inline

Definition at line 5216 of file constraint_solver.h.

◆ BackwardSequence()

const std::vector< int > & BackwardSequence ( const SequenceVar *const  var) const

◆ BaseName()

virtual std::string BaseName ( ) const
virtualinherited

Returns a base name for automatic naming.

Reimplemented in BooleanVar.

◆ Bound()

bool Bound ( const IntVar *const  var) const

◆ Clear()

void Clear ( )

◆ ClearObjective()

void ClearObjective ( )
inline

Definition at line 5122 of file constraint_solver.h.

◆ Contains() [1/3]

bool Contains ( const IntervalVar *const  var) const

◆ Contains() [2/3]

bool Contains ( const IntVar *const  var) const

◆ Contains() [3/3]

bool Contains ( const SequenceVar *const  var) const

◆ Copy()

void Copy ( const Assignment assignment)

Copies 'assignment' to the current assignment, clearing its previous content.

◆ CopyIntersection()

void CopyIntersection ( const Assignment assignment)

Copies the intersection of the two assignments to the current assignment.

◆ Deactivate() [1/3]

void Deactivate ( const IntervalVar *const  var)

◆ Deactivate() [2/3]

void Deactivate ( const IntVar *const  var)

◆ Deactivate() [3/3]

void Deactivate ( const SequenceVar *const  var)

◆ DeactivateObjective()

void DeactivateObjective ( )

◆ DebugString()

std::string DebugString ( ) const
overridevirtual

Reimplemented from PropagationBaseObject.

◆ DurationMax()

int64_t DurationMax ( const IntervalVar *const  var) const

◆ DurationMin()

int64_t DurationMin ( const IntervalVar *const  var) const

◆ DurationValue()

int64_t DurationValue ( const IntervalVar *const  var) const

◆ Empty()

bool Empty ( ) const
inline

Definition at line 5094 of file constraint_solver.h.

◆ EndMax()

int64_t EndMax ( const IntervalVar *const  var) const

◆ EndMin()

int64_t EndMin ( const IntervalVar *const  var) const

◆ EndValue()

int64_t EndValue ( const IntervalVar *const  var) const

◆ EnqueueAll()

void EnqueueAll ( const SimpleRevFIFO< Demon * > &  demons)
inherited

◆ EnqueueDelayedDemon()

void EnqueueDelayedDemon ( Demon *const  d)
inlineinherited

This method pushes the demon onto the propagation queue.

It will be processed directly if the queue is empty. It will be enqueued according to its priority otherwise.

Definition at line 3209 of file constraint_solver.h.

◆ EnqueueVar()

void EnqueueVar ( Demon *const  d)
inlineinherited

Definition at line 3210 of file constraint_solver.h.

◆ ExecuteAll()

void ExecuteAll ( const SimpleRevFIFO< Demon * > &  demons)
inherited

◆ FastAdd() [1/3]

IntervalVarElement * FastAdd ( IntervalVar *const  var)

Adds without checking if variable has been previously added.

◆ FastAdd() [2/3]

IntVarElement * FastAdd ( IntVar *const  var)

Adds without checking if variable has been previously added.

◆ FastAdd() [3/3]

SequenceVarElement * FastAdd ( SequenceVar *const  var)

Adds without checking if the variable had been previously added.

◆ ForwardSequence()

const std::vector< int > & ForwardSequence ( const SequenceVar *const  var) const

◆ FreezeQueue()

void FreezeQueue ( )
inlineinherited

This method freezes the propagation queue.

It is useful when you need to apply multiple modifications at once.

Definition at line 3200 of file constraint_solver.h.

◆ HasName()

bool HasName ( ) const
inherited

Returns whether the object has been named or not.

◆ HasObjective()

bool HasObjective ( ) const
inline

Definition at line 5124 of file constraint_solver.h.

◆ IntervalVarContainer()

const IntervalContainer & IntervalVarContainer ( ) const
inline

Definition at line 5234 of file constraint_solver.h.

◆ IntVarContainer()

const IntContainer & IntVarContainer ( ) const
inline

Definition at line 5232 of file constraint_solver.h.

◆ Load() [1/3]

void Load ( const AssignmentProto &  assignment_proto)

#if !defined(SWIG)

◆ Load() [2/3]

bool Load ( const std::string &  filename)

Loads an assignment from a file; does not add variables to the assignment (only the variables contained in the assignment are modified).

◆ Load() [3/3]

bool Load ( File *  file)

◆ Max()

int64_t Max ( const IntVar *const  var) const

◆ Min()

int64_t Min ( const IntVar *const  var) const

◆ MutableIntervalVarContainer()

IntervalContainer * MutableIntervalVarContainer ( )
inline

Definition at line 5237 of file constraint_solver.h.

◆ MutableIntVarContainer()

IntContainer * MutableIntVarContainer ( )
inline

Definition at line 5233 of file constraint_solver.h.

◆ MutableSequenceVarContainer()

SequenceContainer * MutableSequenceVarContainer ( )
inline

Definition at line 5243 of file constraint_solver.h.

◆ name()

virtual std::string name ( ) const
virtualinherited

Object naming.

◆ NumIntervalVars()

int NumIntervalVars ( ) const
inline

Definition at line 5102 of file constraint_solver.h.

◆ NumIntVars()

int NumIntVars ( ) const
inline

Definition at line 5101 of file constraint_solver.h.

◆ NumSequenceVars()

int NumSequenceVars ( ) const
inline

Definition at line 5103 of file constraint_solver.h.

◆ Objective()

IntVar * Objective ( ) const

◆ ObjectiveBound()

bool ObjectiveBound ( ) const

◆ ObjectiveMax()

int64_t ObjectiveMax ( ) const

◆ ObjectiveMin()

int64_t ObjectiveMin ( ) const

◆ ObjectiveValue()

int64_t ObjectiveValue ( ) const

◆ operator!=()

bool operator!= ( const Assignment assignment) const
inline

Definition at line 5252 of file constraint_solver.h.

◆ operator==()

bool operator== ( const Assignment assignment) const
inline

Definition at line 5246 of file constraint_solver.h.

◆ PerformedMax()

int64_t PerformedMax ( const IntervalVar *const  var) const

◆ PerformedMin()

int64_t PerformedMin ( const IntervalVar *const  var) const

◆ PerformedValue()

int64_t PerformedValue ( const IntervalVar *const  var) const

◆ reset_action_on_fail()

void reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 3223 of file constraint_solver.h.

◆ Restore()

void Restore ( )

◆ Save() [1/3]

void Save ( AssignmentProto *const  assignment_proto) const

◆ Save() [2/3]

bool Save ( const std::string &  filename) const

Saves the assignment to a file.

◆ Save() [3/3]

bool Save ( File *  file) const

◆ SequenceVarContainer()

const SequenceContainer & SequenceVarContainer ( ) const
inline

Definition at line 5240 of file constraint_solver.h.

◆ set_action_on_fail()

void set_action_on_fail ( Solver::Action  a)
inlineinherited

Definition at line 3217 of file constraint_solver.h.

◆ set_name()

void set_name ( const std::string &  name)
inherited

◆ set_variable_to_clean_on_fail()

void set_variable_to_clean_on_fail ( IntVar v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 3226 of file constraint_solver.h.

◆ SetBackwardSequence()

void SetBackwardSequence ( const SequenceVar *const  var,
const std::vector< int > &  backward_sequence 
)

◆ SetDurationMax()

void SetDurationMax ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetDurationMin()

void SetDurationMin ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetDurationRange()

void SetDurationRange ( const IntervalVar *const  var,
int64_t  mi,
int64_t  ma 
)

◆ SetDurationValue()

void SetDurationValue ( const IntervalVar *const  var,
int64_t  value 
)

◆ SetEndMax()

void SetEndMax ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetEndMin()

void SetEndMin ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetEndRange()

void SetEndRange ( const IntervalVar *const  var,
int64_t  mi,
int64_t  ma 
)

◆ SetEndValue()

void SetEndValue ( const IntervalVar *const  var,
int64_t  value 
)

◆ SetForwardSequence()

void SetForwardSequence ( const SequenceVar *const  var,
const std::vector< int > &  forward_sequence 
)

◆ SetMax()

void SetMax ( const IntVar *const  var,
int64_t  m 
)

◆ SetMin()

void SetMin ( const IntVar *const  var,
int64_t  m 
)

◆ SetObjectiveMax()

void SetObjectiveMax ( int64_t  m)

◆ SetObjectiveMin()

void SetObjectiveMin ( int64_t  m)

◆ SetObjectiveRange()

void SetObjectiveRange ( int64_t  l,
int64_t  u 
)

◆ SetObjectiveValue()

void SetObjectiveValue ( int64_t  value)

◆ SetPerformedMax()

void SetPerformedMax ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetPerformedMin()

void SetPerformedMin ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetPerformedRange()

void SetPerformedRange ( const IntervalVar *const  var,
int64_t  mi,
int64_t  ma 
)

◆ SetPerformedValue()

void SetPerformedValue ( const IntervalVar *const  var,
int64_t  value 
)

◆ SetRange()

void SetRange ( const IntVar *const  var,
int64_t  l,
int64_t  u 
)

◆ SetSequence()

void SetSequence ( const SequenceVar *const  var,
const std::vector< int > &  forward_sequence,
const std::vector< int > &  backward_sequence,
const std::vector< int > &  unperformed 
)

◆ SetStartMax()

void SetStartMax ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetStartMin()

void SetStartMin ( const IntervalVar *const  var,
int64_t  m 
)

◆ SetStartRange()

void SetStartRange ( const IntervalVar *const  var,
int64_t  mi,
int64_t  ma 
)

◆ SetStartValue()

void SetStartValue ( const IntervalVar *const  var,
int64_t  value 
)

◆ SetUnperformed()

void SetUnperformed ( const SequenceVar *const  var,
const std::vector< int > &  unperformed 
)

◆ SetValue()

void SetValue ( const IntVar *const  var,
int64_t  value 
)

◆ Size()

int Size ( ) const
inline

Definition at line 5098 of file constraint_solver.h.

◆ solver()

Solver * solver ( ) const
inlineinherited

Definition at line 3196 of file constraint_solver.h.

◆ StartMax()

int64_t StartMax ( const IntervalVar *const  var) const

◆ StartMin()

int64_t StartMin ( const IntervalVar *const  var) const

◆ StartValue()

int64_t StartValue ( const IntervalVar *const  var) const

◆ Store()

void Store ( )

◆ UnfreezeQueue()

void UnfreezeQueue ( )
inlineinherited

This method unfreezes the propagation queue.

All modifications that happened when the queue was frozen will be processed.

Definition at line 3204 of file constraint_solver.h.

◆ Unperformed()

const std::vector< int > & Unperformed ( const SequenceVar *const  var) const

◆ Value()

int64_t Value ( const IntVar *const  var) const

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