OR-Tools  8.2
SequenceVar

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...
 
IntervalVarInterval (int index) const
 Returns the index_th interval of the sequence. More...
 
IntVarNext (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...
 
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...
 

Constructor & Destructor Documentation

◆ SequenceVar()

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.

◆ ~SequenceVar()

~SequenceVar ( )
override

Definition at line 48 of file sched_search.cc.

Member Function Documentation

◆ Accept()

void Accept ( ModelVisitor *const  visitor) const
virtual

Accepts the given visitor.

Definition at line 71 of file sched_search.cc.

◆ 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.

Definition at line 106 of file sched_search.cc.

◆ BaseName()

std::string BaseName ( ) const
virtualinherited

Returns a base name for automatic naming.

Reimplemented in BooleanVar.

Definition at line 2515 of file constraint_solver.cc.

◆ 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.

Definition at line 188 of file sched_search.cc.

◆ ComputeStatistics()

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.

◆ DebugString()

std::string DebugString ( ) const
overridevirtual

Reimplemented from PropagationBaseObject.

Definition at line 56 of file sched_search.cc.

◆ DurationRange()

void DurationRange ( int64 *const  dmin,
int64 *const  dmax 
) const

Returns the minimum and maximum duration of combined interval vars in the sequence.

Definition at line 75 of file sched_search.cc.

◆ EnqueueAll()

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

Definition at line 2521 of file constraint_solver.cc.

◆ 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 3192 of file constraint_solver.h.

◆ EnqueueVar()

void EnqueueVar ( Demon *const  d)
inlineinherited

Definition at line 3193 of file constraint_solver.h.

◆ ExecuteAll()

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

Definition at line 2517 of file constraint_solver.cc.

◆ 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.

Definition at line 346 of file sched_search.cc.

◆ 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 3183 of file constraint_solver.h.

◆ HasName()

bool HasName ( ) const
inherited

Returns whether the object has been named or not.

Definition at line 2513 of file constraint_solver.cc.

◆ 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.

Definition at line 91 of file sched_search.cc.

◆ Interval()

IntervalVar * Interval ( int  index) const

Returns the index_th interval of the sequence.

Definition at line 50 of file sched_search.cc.

◆ name()

std::string name ( ) const
virtualinherited

Object naming.

Reimplemented in PiecewiseLinearExpr.

Definition at line 2505 of file constraint_solver.cc.

◆ Next()

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.

◆ 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.

Definition at line 291 of file sched_search.cc.

◆ 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.

Definition at line 314 of file sched_search.cc.

◆ RankNotFirst()

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.

◆ RankNotLast()

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.

◆ 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.

Definition at line 266 of file sched_search.cc.

◆ reset_action_on_fail()

void reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 3206 of file constraint_solver.h.

◆ set_action_on_fail()

void set_action_on_fail ( Solver::Action  a)
inlineinherited

Definition at line 3200 of file constraint_solver.h.

◆ set_name()

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

Definition at line 2509 of file constraint_solver.cc.

◆ set_variable_to_clean_on_fail()

void set_variable_to_clean_on_fail ( IntVar v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 3209 of file constraint_solver.h.

◆ size()

int64 size ( ) const
inline

Returns the number of interval vars in the sequence.

Definition at line 4624 of file constraint_solver.h.

◆ solver()

Solver* solver ( ) const
inlineinherited

Definition at line 3179 of file constraint_solver.h.

◆ 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 3187 of file constraint_solver.h.


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