C++ Reference
C++ Reference: Routing
Detailed Description
A sequence variable is a variable whose domain is a set of possible orderings of the interval variables.
It allows ordering of tasks. It has two sets of methods: ComputePossibleFirstsAndLasts(), which returns the list of interval variables that can be ranked first or last; and RankFirst/RankNotFirst/RankLast/RankNotLast, which can be used to create the search decision.
Definition at line 4548 of file constraint_solver.h.
Public Member Functions | |
SequenceVar (Solver *const s, const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &nexts, const std::string &name) | |
~SequenceVar () override | |
std::string | DebugString () const override |
void | DurationRange (int64 *const dmin, int64 *const dmax) const |
Returns the minimum and maximum duration of combined interval vars in the sequence. More... | |
void | HorizonRange (int64 *const hmin, int64 *const hmax) const |
Returns the minimum start min and the maximum end max of all interval vars in the sequence. More... | |
void | ActiveHorizonRange (int64 *const hmin, int64 *const hmax) const |
Returns the minimum start min and the maximum end max of all unranked interval vars in the sequence. More... | |
void | ComputeStatistics (int *const ranked, int *const not_ranked, int *const unperformed) const |
Compute statistics on the sequence. More... | |
void | RankFirst (int index) |
Ranks the index_th interval var first of all unranked interval vars. More... | |
void | RankNotFirst (int index) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars. More... | |
void | RankLast (int index) |
Ranks the index_th interval var first of all unranked interval vars. More... | |
void | RankNotLast (int index) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars. More... | |
void | ComputePossibleFirstsAndLasts (std::vector< int > *const possible_firsts, std::vector< int > *const possible_lasts) |
Computes the set of indices of interval variables that can be ranked first in the set of unranked activities. More... | |
void | RankSequence (const std::vector< int > &rank_first, const std::vector< int > &rank_last, const std::vector< int > &unperformed) |
Applies the following sequence of ranks, ranks first, then rank last. More... | |
void | FillSequence (std::vector< int > *const rank_first, std::vector< int > *const rank_last, std::vector< int > *const unperformed) const |
Clears 'rank_first' and 'rank_last', and fills them with the intervals in the order of the ranks. More... | |
IntervalVar * | Interval (int index) const |
Returns the index_th interval of the sequence. More... | |
IntVar * | Next (int index) const |
Returns the next of the index_th interval of the sequence. More... | |
int64 | size () const |
Returns the number of interval vars in the sequence. More... | |
virtual void | Accept (ModelVisitor *const visitor) const |
Accepts the given visitor. More... | |
Solver * | solver () 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... | |
Constructor & Destructor Documentation
◆ SequenceVar()
SequenceVar | ( | Solver *const | s, |
const std::vector< IntervalVar * > & | intervals, | ||
const std::vector< IntVar * > & | nexts, | ||
const std::string & | name | ||
) |
◆ ~SequenceVar()
|
override |
Member Function Documentation
◆ Accept()
|
virtual |
Accepts the given visitor.
◆ ActiveHorizonRange()
void ActiveHorizonRange | ( | int64 *const | hmin, |
int64 *const | hmax | ||
) | const |
Returns the minimum start min and the maximum end max of all unranked interval vars in the sequence.
◆ BaseName()
|
virtualinherited |
Returns a base name for automatic naming.
Reimplemented in BooleanVar.
◆ ComputePossibleFirstsAndLasts()
void ComputePossibleFirstsAndLasts | ( | std::vector< int > *const | possible_firsts, |
std::vector< int > *const | possible_lasts | ||
) |
Computes the set of indices of interval variables that can be ranked first in the set of unranked activities.
◆ ComputeStatistics()
void ComputeStatistics | ( | int *const | ranked, |
int *const | not_ranked, | ||
int *const | unperformed | ||
) | const |
Compute statistics on the sequence.
◆ DebugString()
|
overridevirtual |
Reimplemented from PropagationBaseObject.
◆ DurationRange()
void DurationRange | ( | int64 *const | dmin, |
int64 *const | dmax | ||
) | const |
Returns the minimum and maximum duration of combined interval vars in the sequence.
◆ EnqueueAll()
|
inherited |
◆ EnqueueDelayedDemon()
|
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 3192 of file constraint_solver.h.
◆ EnqueueVar()
|
inlineinherited |
Definition at line 3193 of file constraint_solver.h.
◆ ExecuteAll()
|
inherited |
◆ FillSequence()
void FillSequence | ( | std::vector< int > *const | rank_first, |
std::vector< int > *const | rank_last, | ||
std::vector< int > *const | unperformed | ||
) | const |
Clears 'rank_first' and 'rank_last', and fills them with the intervals in the order of the ranks.
If all variables are ranked, 'rank_first' will contain all variables, and 'rank_last' will contain none. 'unperformed' will contains all such interval variables. rank_first and rank_last represents different directions. rank_first[0] corresponds to the first interval of the sequence. rank_last[0] corresponds to the last interval of the sequence.
◆ FreezeQueue()
|
inlineinherited |
This method freezes the propagation queue.
It is useful when you need to apply multiple modifications at once.
Definition at line 3183 of file constraint_solver.h.
◆ HasName()
|
inherited |
Returns whether the object has been named or not.
◆ HorizonRange()
void HorizonRange | ( | int64 *const | hmin, |
int64 *const | hmax | ||
) | const |
Returns the minimum start min and the maximum end max of all interval vars in the sequence.
◆ Interval()
IntervalVar * Interval | ( | int | index | ) | const |
Returns the index_th interval of the sequence.
◆ name()
|
virtualinherited |
Object naming.
◆ Next()
IntVar * Next | ( | int | index | ) | const |
Returns the next of the index_th interval of the sequence.
◆ RankFirst()
void RankFirst | ( | int | index | ) |
Ranks the index_th interval var first of all unranked interval vars.
After that, it will no longer be considered ranked.
◆ RankLast()
void RankLast | ( | int | index | ) |
Ranks the index_th interval var first of all unranked interval vars.
After that, it will no longer be considered ranked.
◆ RankNotFirst()
void RankNotFirst | ( | int | index | ) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.
◆ RankNotLast()
void RankNotLast | ( | int | index | ) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.
◆ RankSequence()
void RankSequence | ( | const std::vector< int > & | rank_first, |
const std::vector< int > & | rank_last, | ||
const std::vector< int > & | unperformed | ||
) |
Applies the following sequence of ranks, ranks first, then rank last.
rank_first and rank_last represents different directions. rank_first[0] corresponds to the first interval of the sequence. rank_last[0] corresponds to the last interval of the sequence. All intervals in the unperformed vector will be marked as such.
◆ reset_action_on_fail()
|
inlineinherited |
This method clears the failure callback.
Definition at line 3206 of file constraint_solver.h.
◆ set_action_on_fail()
|
inlineinherited |
Definition at line 3200 of file constraint_solver.h.
◆ set_name()
|
inherited |
◆ set_variable_to_clean_on_fail()
|
inlineinherited |
Shortcut for variable cleaner.
Definition at line 3209 of file constraint_solver.h.
◆ size()
|
inline |
Returns the number of interval vars in the sequence.
Definition at line 4624 of file constraint_solver.h.
◆ solver()
|
inlineinherited |
Definition at line 3179 of file constraint_solver.h.
◆ UnfreezeQueue()
|
inlineinherited |
This method unfreezes the propagation queue.
All modifications that happened when the queue was frozen will be processed.
Definition at line 3187 of file constraint_solver.h.
The documentation for this class was generated from the following file: