![]() |
OR-Tools
8.2
|
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... | |
SequenceVar | ( | Solver *const | s, |
const std::vector< IntervalVar * > & | intervals, | ||
const std::vector< IntVar * > & | nexts, | ||
const std::string & | name | ||
) |
Definition at line 37 of file sched_search.cc.
|
override |
Definition at line 48 of file sched_search.cc.
|
virtual |
Accepts the given visitor.
Definition at line 71 of file sched_search.cc.
Returns the minimum start min and the maximum end max of all unranked interval vars in the sequence.
Definition at line 106 of file sched_search.cc.
|
virtualinherited |
Returns a base name for automatic naming.
Reimplemented in BooleanVar.
Definition at line 2515 of file constraint_solver.cc.
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.
Definition at line 188 of file sched_search.cc.
void ComputeStatistics | ( | int *const | ranked, |
int *const | not_ranked, | ||
int *const | unperformed | ||
) | const |
Compute statistics on the sequence.
Definition at line 144 of file sched_search.cc.
|
overridevirtual |
Reimplemented from PropagationBaseObject.
Definition at line 56 of file sched_search.cc.
Returns the minimum and maximum duration of combined interval vars in the sequence.
Definition at line 75 of file sched_search.cc.
|
inherited |
Definition at line 2521 of file constraint_solver.cc.
|
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.
|
inlineinherited |
Definition at line 3193 of file constraint_solver.h.
|
inherited |
Definition at line 2517 of file constraint_solver.cc.
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.
Definition at line 346 of file sched_search.cc.
|
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.
|
inherited |
Returns whether the object has been named or not.
Definition at line 2513 of file constraint_solver.cc.
Returns the minimum start min and the maximum end max of all interval vars in the sequence.
Definition at line 91 of file sched_search.cc.
IntervalVar * Interval | ( | int | index | ) | const |
Returns the index_th interval of the sequence.
Definition at line 50 of file sched_search.cc.
|
virtualinherited |
Object naming.
Reimplemented in PiecewiseLinearExpr.
Definition at line 2505 of file constraint_solver.cc.
IntVar * Next | ( | int | index | ) | const |
Returns the next of the index_th interval of the sequence.
Definition at line 54 of file sched_search.cc.
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.
Definition at line 291 of file sched_search.cc.
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.
Definition at line 314 of file sched_search.cc.
void RankNotFirst | ( | int | index | ) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.
Definition at line 306 of file sched_search.cc.
void RankNotLast | ( | int | index | ) |
Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.
Definition at line 329 of file sched_search.cc.
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.
Definition at line 266 of file sched_search.cc.
|
inlineinherited |
This method clears the failure callback.
Definition at line 3206 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3200 of file constraint_solver.h.
|
inherited |
Definition at line 2509 of file constraint_solver.cc.
|
inlineinherited |
Shortcut for variable cleaner.
Definition at line 3209 of file constraint_solver.h.
|
inline |
Returns the number of interval vars in the sequence.
Definition at line 4624 of file constraint_solver.h.
|
inlineinherited |
Definition at line 3179 of file constraint_solver.h.
|
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.