Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::DemonProfiler Class Reference
Inheritance diagram for operations_research::DemonProfiler:
operations_research::PropagationMonitor operations_research::SearchMonitor operations_research::BaseObject

Public Member Functions

 DemonProfiler (Solver *const solver)
 
 ~DemonProfiler () override
 
int64_t CurrentTime () const
 
void BeginConstraintInitialPropagation (Constraint *const constraint) override
 Propagation events.
 
void EndConstraintInitialPropagation (Constraint *const constraint) override
 
void BeginNestedConstraintInitialPropagation (Constraint *const constraint, Constraint *const delayed) override
 
void EndNestedConstraintInitialPropagation (Constraint *const constraint, Constraint *const delayed) override
 
void RegisterDemon (Demon *const demon) override
 
void BeginDemonRun (Demon *const demon) override
 
void EndDemonRun (Demon *const demon) override
 
void StartProcessingIntegerVariable (IntVar *const var) override
 
void EndProcessingIntegerVariable (IntVar *const var) override
 
void PushContext (const std::string &context) override
 
void PopContext () override
 
void BeginFail () override
 Just when the failure occurs.
 
void RestartSearch () override
 Restarts a search and clears all previously collected information.
 
void SetMin (IntExpr *const expr, int64_t new_min) override
 IntExpr modifiers.
 
void SetMax (IntExpr *const expr, int64_t new_max) override
 
void SetRange (IntExpr *const expr, int64_t new_min, int64_t new_max) override
 
void SetMin (IntVar *const var, int64_t new_min) override
 IntVar modifiers.
 
void SetMax (IntVar *const var, int64_t new_max) override
 
void SetRange (IntVar *const var, int64_t new_min, int64_t new_max) override
 
void RemoveValue (IntVar *const var, int64_t value) override
 
void SetValue (IntVar *const var, int64_t value) override
 
void RemoveInterval (IntVar *const var, int64_t imin, int64_t imax) override
 
void SetValues (IntVar *const var, const std::vector< int64_t > &values) override
 
void RemoveValues (IntVar *const var, const std::vector< int64_t > &values) override
 
void SetStartMin (IntervalVar *const var, int64_t new_min) override
 IntervalVar modifiers.
 
void SetStartMax (IntervalVar *const var, int64_t new_max) override
 
void SetStartRange (IntervalVar *const var, int64_t new_min, int64_t new_max) override
 
void SetEndMin (IntervalVar *const var, int64_t new_min) override
 
void SetEndMax (IntervalVar *const var, int64_t new_max) override
 
void SetEndRange (IntervalVar *const var, int64_t new_min, int64_t new_max) override
 
void SetDurationMin (IntervalVar *const var, int64_t new_min) override
 
void SetDurationMax (IntervalVar *const var, int64_t new_max) override
 
void SetDurationRange (IntervalVar *const var, int64_t new_min, int64_t new_max) override
 
void SetPerformed (IntervalVar *const var, bool value) override
 
void RankFirst (SequenceVar *const var, int index) override
 SequenceVar modifiers.
 
void RankNotFirst (SequenceVar *const var, int index) override
 
void RankLast (SequenceVar *const var, int index) override
 
void RankNotLast (SequenceVar *const var, int index) override
 
void RankSequence (SequenceVar *const var, const std::vector< int > &rank_first, const std::vector< int > &rank_last, const std::vector< int > &unperformed) override
 
void AddFakeRun (Demon *const demon, int64_t start_time, int64_t end_time, bool is_fail)
 Useful for unit tests.
 
void PrintOverview (Solver *const solver, absl::string_view filename)
 Exports collected data as human-readable text.
 
void ExportInformation (const Constraint *const constraint, int64_t *const fails, int64_t *const initial_propagation_runtime, int64_t *const demon_invocations, int64_t *const total_demon_runtime, int *demons)
 Export Information.
 
void ExportInformation (const DemonRuns *const demon_runs, int64_t *const demon_invocations, int64_t *const fails, int64_t *const total_demon_runtime, double *const mean_demon_runtime, double *const median_demon_runtime, double *const stddev_demon_runtime)
 
void Install () override
 
std::string DebugString () const override
 
- Public Member Functions inherited from operations_research::PropagationMonitor
 PropagationMonitor (Solver *solver)
 -------— Propagation Monitor --------—
 
 ~PropagationMonitor () override
 
std::string DebugString () const override
 
void Install () override
 Install itself on the solver.
 
- Public Member Functions inherited from operations_research::SearchMonitor
 SearchMonitor (Solver *const s)
 
 SearchMonitor (const SearchMonitor &)=delete
 This type is neither copyable nor movable.
 
SearchMonitoroperator= (const SearchMonitor &)=delete
 
 ~SearchMonitor () override
 
virtual void EnterSearch ()
 Beginning of the search.
 
virtual void ExitSearch ()
 End of the search.
 
virtual void BeginNextDecision (DecisionBuilder *b)
 Before calling DecisionBuilder::Next.
 
virtual void EndNextDecision (DecisionBuilder *b, Decision *d)
 After calling DecisionBuilder::Next, along with the returned decision.
 
virtual void ApplyDecision (Decision *d)
 Before applying the decision.
 
virtual void RefuteDecision (Decision *d)
 Before refuting the decision.
 
virtual void AfterDecision (Decision *d, bool apply)
 
virtual void EndFail ()
 After completing the backtrack.
 
virtual void BeginInitialPropagation ()
 Before the initial propagation.
 
virtual void EndInitialPropagation ()
 After the initial propagation.
 
virtual bool AcceptSolution ()
 
virtual bool AtSolution ()
 
virtual void NoMoreSolutions ()
 When the search tree is finished.
 
virtual bool LocalOptimum ()
 
virtual bool AcceptDelta (Assignment *delta, Assignment *deltadelta)
 
virtual void AcceptNeighbor ()
 After accepting a neighbor during local search.
 
virtual void AcceptUncheckedNeighbor ()
 After accepting an unchecked neighbor during local search.
 
virtual bool IsUncheckedSolutionLimitReached ()
 
virtual void PeriodicCheck ()
 Periodic call to check limits in long running methods.
 
virtual int ProgressPercent ()
 
virtual void Accept (ModelVisitor *visitor) const
 Accepts the given model visitor.
 
Solversolver () const
 
- 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 ()
 

Additional Inherited Members

- Static Public Attributes inherited from operations_research::SearchMonitor
static constexpr int kNoProgress = -1
 
- Protected Member Functions inherited from operations_research::SearchMonitor
void ListenToEvent (Solver::MonitorEvent event)
 

Detailed Description

DemonProfiler manages the profiling of demons and allows access to gathered data. Add this class as a parameter to Solver and access its information after the end of a search.

Definition at line 53 of file demon_profiler.cc.

Constructor & Destructor Documentation

◆ DemonProfiler()

operations_research::DemonProfiler::DemonProfiler ( Solver *const solver)
inlineexplicit

Definition at line 55 of file demon_profiler.cc.

◆ ~DemonProfiler()

operations_research::DemonProfiler::~DemonProfiler ( )
inlineoverride

Definition at line 61 of file demon_profiler.cc.

Member Function Documentation

◆ AddFakeRun()

void operations_research::DemonProfiler::AddFakeRun ( Demon *const demon,
int64_t start_time,
int64_t end_time,
bool is_fail )
inline

Useful for unit tests.

Definition at line 248 of file demon_profiler.cc.

◆ BeginConstraintInitialPropagation()

void operations_research::DemonProfiler::BeginConstraintInitialPropagation ( Constraint *const constraint)
inlineoverridevirtual

Propagation events.

Implements operations_research::PropagationMonitor.

Definition at line 72 of file demon_profiler.cc.

◆ BeginDemonRun()

void operations_research::DemonProfiler::BeginDemonRun ( Demon *const demon)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 149 of file demon_profiler.cc.

◆ BeginFail()

void operations_research::DemonProfiler::BeginFail ( )
inlineoverridevirtual

Just when the failure occurs.

active_constraint_ can be non null in case of initial propagation.

Reimplemented from operations_research::SearchMonitor.

Definition at line 180 of file demon_profiler.cc.

◆ BeginNestedConstraintInitialPropagation()

void operations_research::DemonProfiler::BeginNestedConstraintInitialPropagation ( Constraint *const constraint,
Constraint *const delayed )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 101 of file demon_profiler.cc.

◆ CurrentTime()

int64_t operations_research::DemonProfiler::CurrentTime ( ) const
inline

In microseconds.

Todo
(user): rename and return nanoseconds.

Definition at line 68 of file demon_profiler.cc.

◆ DebugString()

std::string operations_research::DemonProfiler::DebugString ( ) const
inlineoverridevirtual

Reimplemented from operations_research::BaseObject.

Definition at line 423 of file demon_profiler.cc.

◆ EndConstraintInitialPropagation()

void operations_research::DemonProfiler::EndConstraintInitialPropagation ( Constraint *const constraint)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 88 of file demon_profiler.cc.

◆ EndDemonRun()

void operations_research::DemonProfiler::EndDemonRun ( Demon *const demon)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 162 of file demon_profiler.cc.

◆ EndNestedConstraintInitialPropagation()

void operations_research::DemonProfiler::EndNestedConstraintInitialPropagation ( Constraint *const constraint,
Constraint *const delayed )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 116 of file demon_profiler.cc.

◆ EndProcessingIntegerVariable()

void operations_research::DemonProfiler::EndProcessingIntegerVariable ( IntVar *const var)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 176 of file demon_profiler.cc.

◆ ExportInformation() [1/2]

void operations_research::DemonProfiler::ExportInformation ( const Constraint *const constraint,
int64_t *const fails,
int64_t *const initial_propagation_runtime,
int64_t *const demon_invocations,
int64_t *const total_demon_runtime,
int * demons )
inline

Export Information.

Gather information.

Definition at line 333 of file demon_profiler.cc.

◆ ExportInformation() [2/2]

void operations_research::DemonProfiler::ExportInformation ( const DemonRuns *const demon_runs,
int64_t *const demon_invocations,
int64_t *const fails,
int64_t *const total_demon_runtime,
double *const mean_demon_runtime,
double *const median_demon_runtime,
double *const stddev_demon_runtime )
inline

Compute mean.

Compute median.

Compute standard deviation.

Definition at line 367 of file demon_profiler.cc.

◆ Install()

void operations_research::DemonProfiler::Install ( )
inlineoverridevirtual

The demon_profiler is added by default on the main propagation monitor. It just needs to be added to the search monitors at the start of the search.

Reimplemented from operations_research::SearchMonitor.

Definition at line 421 of file demon_profiler.cc.

◆ PopContext()

void operations_research::DemonProfiler::PopContext ( )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 178 of file demon_profiler.cc.

◆ PrintOverview()

void operations_research::DemonProfiler::PrintOverview ( Solver *const solver,
absl::string_view filename )
inline

Exports collected data as human-readable text.

Definition at line 261 of file demon_profiler.cc.

◆ PushContext()

void operations_research::DemonProfiler::PushContext ( const std::string & context)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 177 of file demon_profiler.cc.

◆ RankFirst()

void operations_research::DemonProfiler::RankFirst ( SequenceVar *const var,
int index )
inlineoverridevirtual

SequenceVar modifiers.

Implements operations_research::PropagationMonitor.

Definition at line 239 of file demon_profiler.cc.

◆ RankLast()

void operations_research::DemonProfiler::RankLast ( SequenceVar *const var,
int index )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 241 of file demon_profiler.cc.

◆ RankNotFirst()

void operations_research::DemonProfiler::RankNotFirst ( SequenceVar *const var,
int index )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 240 of file demon_profiler.cc.

◆ RankNotLast()

void operations_research::DemonProfiler::RankNotLast ( SequenceVar *const var,
int index )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 242 of file demon_profiler.cc.

◆ RankSequence()

void operations_research::DemonProfiler::RankSequence ( SequenceVar *const var,
const std::vector< int > & rank_first,
const std::vector< int > & rank_last,
const std::vector< int > & unperformed )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 243 of file demon_profiler.cc.

◆ RegisterDemon()

void operations_research::DemonProfiler::RegisterDemon ( Demon *const demon)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 131 of file demon_profiler.cc.

◆ RemoveInterval()

void operations_research::DemonProfiler::RemoveInterval ( IntVar *const var,
int64_t imin,
int64_t imax )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 220 of file demon_profiler.cc.

◆ RemoveValue()

void operations_research::DemonProfiler::RemoveValue ( IntVar *const var,
int64_t value )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 218 of file demon_profiler.cc.

◆ RemoveValues()

void operations_research::DemonProfiler::RemoveValues ( IntVar *const var,
const std::vector< int64_t > & values )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 223 of file demon_profiler.cc.

◆ RestartSearch()

void operations_research::DemonProfiler::RestartSearch ( )
inlineoverridevirtual

Restarts a search and clears all previously collected information.

Reimplemented from operations_research::SearchMonitor.

Definition at line 201 of file demon_profiler.cc.

◆ SetDurationMax()

void operations_research::DemonProfiler::SetDurationMax ( IntervalVar *const var,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 235 of file demon_profiler.cc.

◆ SetDurationMin()

void operations_research::DemonProfiler::SetDurationMin ( IntervalVar *const var,
int64_t new_min )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 234 of file demon_profiler.cc.

◆ SetDurationRange()

void operations_research::DemonProfiler::SetDurationRange ( IntervalVar *const var,
int64_t new_min,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 236 of file demon_profiler.cc.

◆ SetEndMax()

void operations_research::DemonProfiler::SetEndMax ( IntervalVar *const var,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 231 of file demon_profiler.cc.

◆ SetEndMin()

void operations_research::DemonProfiler::SetEndMin ( IntervalVar *const var,
int64_t new_min )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 230 of file demon_profiler.cc.

◆ SetEndRange()

void operations_research::DemonProfiler::SetEndRange ( IntervalVar *const var,
int64_t new_min,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 232 of file demon_profiler.cc.

◆ SetMax() [1/2]

void operations_research::DemonProfiler::SetMax ( IntExpr *const expr,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 211 of file demon_profiler.cc.

◆ SetMax() [2/2]

void operations_research::DemonProfiler::SetMax ( IntVar *const var,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 216 of file demon_profiler.cc.

◆ SetMin() [1/2]

void operations_research::DemonProfiler::SetMin ( IntExpr *const expr,
int64_t new_min )
inlineoverridevirtual

IntExpr modifiers.

Implements operations_research::PropagationMonitor.

Definition at line 210 of file demon_profiler.cc.

◆ SetMin() [2/2]

void operations_research::DemonProfiler::SetMin ( IntVar *const var,
int64_t new_min )
inlineoverridevirtual

IntVar modifiers.

Implements operations_research::PropagationMonitor.

Definition at line 215 of file demon_profiler.cc.

◆ SetPerformed()

void operations_research::DemonProfiler::SetPerformed ( IntervalVar *const var,
bool value )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 238 of file demon_profiler.cc.

◆ SetRange() [1/2]

void operations_research::DemonProfiler::SetRange ( IntExpr *const expr,
int64_t new_min,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 212 of file demon_profiler.cc.

◆ SetRange() [2/2]

void operations_research::DemonProfiler::SetRange ( IntVar *const var,
int64_t new_min,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 217 of file demon_profiler.cc.

◆ SetStartMax()

void operations_research::DemonProfiler::SetStartMax ( IntervalVar *const var,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 227 of file demon_profiler.cc.

◆ SetStartMin()

void operations_research::DemonProfiler::SetStartMin ( IntervalVar *const var,
int64_t new_min )
inlineoverridevirtual

IntervalVar modifiers.

Implements operations_research::PropagationMonitor.

Definition at line 226 of file demon_profiler.cc.

◆ SetStartRange()

void operations_research::DemonProfiler::SetStartRange ( IntervalVar *const var,
int64_t new_min,
int64_t new_max )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 228 of file demon_profiler.cc.

◆ SetValue()

void operations_research::DemonProfiler::SetValue ( IntVar *const var,
int64_t value )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 219 of file demon_profiler.cc.

◆ SetValues()

void operations_research::DemonProfiler::SetValues ( IntVar *const var,
const std::vector< int64_t > & values )
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 221 of file demon_profiler.cc.

◆ StartProcessingIntegerVariable()

void operations_research::DemonProfiler::StartProcessingIntegerVariable ( IntVar *const var)
inlineoverridevirtual

Implements operations_research::PropagationMonitor.

Definition at line 175 of file demon_profiler.cc.


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