Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::SequenceVar Class Reference

#include <constraint_solver.h>

Inheritance diagram for operations_research::SequenceVar:
operations_research::PropagationBaseObject operations_research::BaseObject

Public Member Functions

 SequenceVar (Solver *s, const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &nexts, const std::string &name)
 --— SequenceVar --—
 
 ~SequenceVar () override
 
std::string DebugString () const override
 
void DurationRange (int64_t *dmin, int64_t *dmax) const
 
void HorizonRange (int64_t *hmin, int64_t *hmax) const
 
void ActiveHorizonRange (int64_t *hmin, int64_t *hmax) const
 
void ComputeStatistics (int *ranked, int *not_ranked, int *unperformed) const
 Compute statistics on the sequence.
 
void RankFirst (int index)
 
void RankNotFirst (int index)
 
void RankLast (int index)
 
void RankNotLast (int index)
 
void ComputePossibleFirstsAndLasts (std::vector< int > *possible_firsts, std::vector< int > *possible_lasts)
 
void RankSequence (const std::vector< int > &rank_first, const std::vector< int > &rank_last, const std::vector< int > &unperformed)
 
void FillSequence (std::vector< int > *rank_first, std::vector< int > *rank_last, std::vector< int > *unperformed) const
 
IntervalVarInterval (int index) const
 Returns the index_th interval of the sequence.
 
IntVarNext (int index) const
 Returns the next of the index_th interval of the sequence.
 
int64_t size () const
 Returns the number of interval vars in the sequence.
 
virtual void Accept (ModelVisitor *visitor) const
 Accepts the given visitor.
 
- Public Member Functions inherited from operations_research::PropagationBaseObject
 PropagationBaseObject (Solver *const s)
 
 PropagationBaseObject (const PropagationBaseObject &)=delete
 This type is neither copyable nor movable.
 
PropagationBaseObjectoperator= (const PropagationBaseObject &)=delete
 
 ~PropagationBaseObject () override
 
Solversolver () const
 
void FreezeQueue ()
 
void UnfreezeQueue ()
 
void EnqueueDelayedDemon (Demon *const d)
 
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.
 
void set_variable_to_clean_on_fail (IntVar *v)
 Shortcut for variable cleaner.
 
virtual std::string name () const
 Object naming.
 
void set_name (absl::string_view name)
 
bool HasName () const
 Returns whether the object has been named or not.
 
virtual std::string BaseName () const
 Returns a base name for automatic naming.
 
- Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 

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

Constructor & Destructor Documentation

◆ SequenceVar()

operations_research::SequenceVar::SequenceVar ( Solver * s,
const std::vector< IntervalVar * > & intervals,
const std::vector< IntVar * > & nexts,
const std::string & name )

--— SequenceVar --—

Todo
(user): Add better class invariants, in particular checks that ranked_first, ranked_last, and unperformed are truly disjoint.

Definition at line 41 of file sched_search.cc.

◆ ~SequenceVar()

operations_research::SequenceVar::~SequenceVar ( )
override

Definition at line 52 of file sched_search.cc.

Member Function Documentation

◆ Accept()

void operations_research::SequenceVar::Accept ( ModelVisitor * visitor) const
virtual

Accepts the given visitor.

Definition at line 75 of file sched_search.cc.

◆ ActiveHorizonRange()

void operations_research::SequenceVar::ActiveHorizonRange ( int64_t * hmin,
int64_t * hmax ) const

Returns the minimum start min and the maximum end max of all unranked interval vars in the sequence.

Definition at line 111 of file sched_search.cc.

◆ ComputePossibleFirstsAndLasts()

void operations_research::SequenceVar::ComputePossibleFirstsAndLasts ( std::vector< int > * possible_firsts,
std::vector< int > * possible_lasts )

Computes the set of indices of interval variables that can be ranked first in the set of unranked activities.

Todo
(user): use domain iterator.

Definition at line 193 of file sched_search.cc.

◆ ComputeStatistics()

void operations_research::SequenceVar::ComputeStatistics ( int * ranked,
int * not_ranked,
int * unperformed ) const

Compute statistics on the sequence.

Definition at line 149 of file sched_search.cc.

◆ DebugString()

std::string operations_research::SequenceVar::DebugString ( ) const
overridevirtual

Reimplemented from operations_research::PropagationBaseObject.

Definition at line 60 of file sched_search.cc.

◆ DurationRange()

void operations_research::SequenceVar::DurationRange ( int64_t * dmin,
int64_t * dmax ) const

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

Definition at line 79 of file sched_search.cc.

◆ FillSequence()

void operations_research::SequenceVar::FillSequence ( std::vector< int > * rank_first,
std::vector< int > * rank_last,
std::vector< int > * 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 351 of file sched_search.cc.

◆ HorizonRange()

void operations_research::SequenceVar::HorizonRange ( int64_t * hmin,
int64_t * hmax ) const

Returns the minimum start min and the maximum end max of all interval vars in the sequence.

Definition at line 96 of file sched_search.cc.

◆ Interval()

IntervalVar * operations_research::SequenceVar::Interval ( int index) const

Returns the index_th interval of the sequence.

Definition at line 54 of file sched_search.cc.

◆ Next()

IntVar * operations_research::SequenceVar::Next ( int index) const

Returns the next of the index_th interval of the sequence.

Definition at line 58 of file sched_search.cc.

◆ RankFirst()

void operations_research::SequenceVar::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 296 of file sched_search.cc.

◆ RankLast()

void operations_research::SequenceVar::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 319 of file sched_search.cc.

◆ RankNotFirst()

void operations_research::SequenceVar::RankNotFirst ( int index)

Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.

Definition at line 311 of file sched_search.cc.

◆ RankNotLast()

void operations_research::SequenceVar::RankNotLast ( int index)

Indicates that the index_th interval var will not be ranked first of all currently unranked interval vars.

Definition at line 334 of file sched_search.cc.

◆ RankSequence()

void operations_research::SequenceVar::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.

Mark unperformed.

Forward.

Backward.

Definition at line 271 of file sched_search.cc.

◆ size()

int64_t operations_research::SequenceVar::size ( ) const
inline

Returns the number of interval vars in the sequence.

Definition at line 5018 of file constraint_solver.h.


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