![]() |
Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
|
This class is the root class of all solution collectors. It implements a basic query API to be used independently of the collector used.
Definition at line 4470 of file constraint_solver.h.
#include <constraint_solver.h>
Classes | |
| struct | SolutionData |
Public Member Functions | |
| SolutionCollector (Solver *solver, const Assignment *assignment) | |
| SolutionCollector (Solver *solver) | |
| SolutionCollector (const SolutionCollector &)=delete | |
| SolutionCollector & | operator= (const SolutionCollector &)=delete |
| ~SolutionCollector () override | |
| void | Install () override |
| std::string | DebugString () const override |
| void | Add (IntVar *var) |
| Add API. | |
| void | Add (const std::vector< IntVar * > &vars) |
| void | Add (IntervalVar *var) |
| void | Add (const std::vector< IntervalVar * > &vars) |
| void | Add (SequenceVar *var) |
| void | Add (const std::vector< SequenceVar * > &vars) |
| void | AddObjective (IntVar *objective) |
| void | AddObjectives (const std::vector< IntVar * > &objectives) |
| void | EnterSearch () override |
| Beginning of the search. | |
| int | solution_count () const |
| Returns how many solutions were stored during the search. | |
| bool | has_solution () const |
| Returns whether any solutions were stored during the search. | |
| Assignment * | solution (int n) const |
| Returns the nth solution. | |
| Assignment * | last_solution_or_null () const |
| Returns the last solution if there are any, nullptr otherwise. | |
| int64_t | wall_time (int n) const |
| Returns the wall time in ms for the nth solution. | |
| int64_t | branches (int n) const |
| Returns the number of branches when the nth solution was found. | |
| int64_t | failures (int n) const |
| int64_t | objective_value (int n) const |
| Returns the objective value of the nth solution. | |
| int64_t | ObjectiveValueFromIndex (int n, int index) const |
| Returns the value of the index-th objective of the nth solution. | |
| int64_t | Value (int n, IntVar *var) const |
| This is a shortcut to get the Value of 'var' in the nth solution. | |
| int64_t | StartValue (int n, IntervalVar *var) const |
| This is a shortcut to get the StartValue of 'var' in the nth solution. | |
| int64_t | EndValue (int n, IntervalVar *var) const |
| This is a shortcut to get the EndValue of 'var' in the nth solution. | |
| int64_t | DurationValue (int n, IntervalVar *var) const |
| This is a shortcut to get the DurationValue of 'var' in the nth solution. | |
| int64_t | PerformedValue (int n, IntervalVar *var) const |
| This is a shortcut to get the PerformedValue of 'var' in the nth solution. | |
| const std::vector< int > & | ForwardSequence (int n, SequenceVar *var) const |
| const std::vector< int > & | BackwardSequence (int n, SequenceVar *var) const |
| const std::vector< int > & | Unperformed (int n, SequenceVar *var) const |
| Public Member Functions inherited from operations_research::SearchMonitor | |
| SearchMonitor (Solver *const s) | |
| SearchMonitor (const SearchMonitor &)=delete | |
| SearchMonitor & | operator= (const SearchMonitor &)=delete |
| ~SearchMonitor () override | |
| virtual void | RestartSearch () |
| Restart 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 | BeginFail () |
| Just when the failure occurs. | |
| 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 | AtLocalOptimum () |
| 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. | |
| Solver * | solver () const |
| Public Member Functions inherited from operations_research::BaseObject | |
| BaseObject () | |
| BaseObject (const BaseObject &)=delete | |
| BaseObject & | operator= (const BaseObject &)=delete |
| virtual | ~BaseObject ()=default |
Protected Member Functions | |
| void | PushSolution () |
| Push the current state as a new solution. | |
| void | Push (const SolutionData &data) |
| void | PopSolution () |
| Remove and delete the last popped solution. | |
| SolutionData | BuildSolutionDataForCurrentState () |
| void | FreeSolution (Assignment *solution) |
| void | check_index (int n) const |
| Protected Member Functions inherited from operations_research::SearchMonitor | |
| void | ListenToEvent (Solver::MonitorEvent event) |
Protected Attributes | |
| std::unique_ptr< Assignment > | prototype_ |
| std::vector< SolutionData > | solution_data_ |
| std::vector< Assignment * > | recycle_solutions_ |
| std::vector< std::unique_ptr< Assignment > > | solution_pool_ |
Additional Inherited Members | |
| Static Public Attributes inherited from operations_research::SearchMonitor | |
| static constexpr int | kNoProgress = -1 |
| operations_research::SolutionCollector::SolutionCollector | ( | Solver * | solver, |
| const Assignment * | assignment ) |
|
explicit |
|
delete |
|
override |
| void operations_research::SolutionCollector::Add | ( | const std::vector< IntervalVar * > & | vars | ) |
| void operations_research::SolutionCollector::Add | ( | const std::vector< IntVar * > & | vars | ) |
| void operations_research::SolutionCollector::Add | ( | const std::vector< SequenceVar * > & | vars | ) |
| void operations_research::SolutionCollector::Add | ( | IntervalVar * | var | ) |
| void operations_research::SolutionCollector::Add | ( | IntVar * | var | ) |
| void operations_research::SolutionCollector::Add | ( | SequenceVar * | var | ) |
| void operations_research::SolutionCollector::AddObjective | ( | IntVar * | objective | ) |
| void operations_research::SolutionCollector::AddObjectives | ( | const std::vector< IntVar * > & | objectives | ) |
| const std::vector< int > & operations_research::SolutionCollector::BackwardSequence | ( | int | n, |
| SequenceVar * | var ) const |
| int64_t operations_research::SolutionCollector::branches | ( | int | n | ) | const |
|
protected |
|
protected |
|
inlineoverridevirtual |
Reimplemented from operations_research::BaseObject.
Definition at line 4483 of file constraint_solver.h.
| int64_t operations_research::SolutionCollector::DurationValue | ( | int | n, |
| IntervalVar * | var ) const |
| int64_t operations_research::SolutionCollector::EndValue | ( | int | n, |
| IntervalVar * | var ) const |
|
overridevirtual |
Beginning of the search.
Reimplemented from operations_research::SearchMonitor.
| int64_t operations_research::SolutionCollector::failures | ( | int | n | ) | const |
| const std::vector< int > & operations_research::SolutionCollector::ForwardSequence | ( | int | n, |
| SequenceVar * | var ) const |
|
protected |
| bool operations_research::SolutionCollector::has_solution | ( | ) | const |
|
overridevirtual |
Registers itself on the solver such that it gets notified of the search and propagation events. Override to incrementally install listeners for specific events.
Reimplemented from operations_research::SearchMonitor.
| Assignment * operations_research::SolutionCollector::last_solution_or_null | ( | ) | const |
| int64_t operations_research::SolutionCollector::objective_value | ( | int | n | ) | const |
| int64_t operations_research::SolutionCollector::ObjectiveValueFromIndex | ( | int | n, |
| int | index ) const |
|
delete |
| int64_t operations_research::SolutionCollector::PerformedValue | ( | int | n, |
| IntervalVar * | var ) const |
|
protected |
|
inlineprotected |
Definition at line 4566 of file constraint_solver.h.
|
protected |
| Assignment * operations_research::SolutionCollector::solution | ( | int | n | ) | const |
| int operations_research::SolutionCollector::solution_count | ( | ) | const |
| int64_t operations_research::SolutionCollector::StartValue | ( | int | n, |
| IntervalVar * | var ) const |
| const std::vector< int > & operations_research::SolutionCollector::Unperformed | ( | int | n, |
| SequenceVar * | var ) const |
| int64_t operations_research::SolutionCollector::Value | ( | int | n, |
| IntVar * | var ) const |
| int64_t operations_research::SolutionCollector::wall_time | ( | int | n | ) | const |
|
protected |
Definition at line 4573 of file constraint_solver.h.
|
protected |
Definition at line 4575 of file constraint_solver.h.
|
protected |
Definition at line 4574 of file constraint_solver.h.
|
protected |
Definition at line 4577 of file constraint_solver.h.