add sequence API on collector
This commit is contained in:
@@ -3828,6 +3828,8 @@ class SolutionCollector : public SearchMonitor {
|
||||
void Add(const std::vector<IntVar*>& vars);
|
||||
void Add(IntervalVar* const var);
|
||||
void Add(const std::vector<IntervalVar*>& vars);
|
||||
void Add(SequenceVar* const var);
|
||||
void Add(const std::vector<SequenceVar*>& vars);
|
||||
void AddObjective(IntVar* const objective);
|
||||
|
||||
// Beginning of the search.
|
||||
@@ -3867,6 +3869,19 @@ class SolutionCollector : public SearchMonitor {
|
||||
// This is a short-cut to get the PerformedValue of 'var' in the nth solution.
|
||||
int64 PerformedValue(int n, IntervalVar* const var) const;
|
||||
|
||||
#if !defined(SWIG)
|
||||
// This is a short-cut to get the ForwardSequence of 'var' in the
|
||||
// nth solution.
|
||||
const std::vector<int>& ForwardSequence(int n, SequenceVar* const v) const;
|
||||
// This is a short-cut to get the BackwardSequence of 'var' in the
|
||||
// nth solution.
|
||||
const std::vector<int>& BackwardSequence(int n, SequenceVar* const v) const;
|
||||
// This is a short-cut to get the list of unperformed of 'var' in the
|
||||
// nth solution.
|
||||
const std::vector<int>& Unperformed(int n, SequenceVar* const v) const;
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
// Push the current state as a new solution.
|
||||
void PushSolution();
|
||||
|
||||
@@ -2285,6 +2285,18 @@ void SolutionCollector::Add(const std::vector<IntervalVar*>& vars) {
|
||||
}
|
||||
}
|
||||
|
||||
void SolutionCollector::Add(SequenceVar* const var) {
|
||||
if (prototype_.get() != NULL) {
|
||||
prototype_->Add(var);
|
||||
}
|
||||
}
|
||||
|
||||
void SolutionCollector::Add(const std::vector<SequenceVar*>& vars) {
|
||||
if (prototype_.get() != NULL) {
|
||||
prototype_->Add(vars);
|
||||
}
|
||||
}
|
||||
|
||||
void SolutionCollector::AddObjective(IntVar* const objective) {
|
||||
if (prototype_.get() != NULL && objective != NULL) {
|
||||
prototype_->AddObjective(objective);
|
||||
@@ -2399,6 +2411,21 @@ int64 SolutionCollector::PerformedValue(int n, IntervalVar* const var) const {
|
||||
return solutions_[n]->PerformedValue(var);
|
||||
}
|
||||
|
||||
const std::vector<int>& SolutionCollector::ForwardSequence(
|
||||
int n, SequenceVar* const v) const {
|
||||
return solutions_[n]->ForwardSequence(v);
|
||||
}
|
||||
|
||||
const std::vector<int>& SolutionCollector::BackwardSequence(
|
||||
int n, SequenceVar* const v) const {
|
||||
return solutions_[n]->BackwardSequence(v);
|
||||
}
|
||||
|
||||
const std::vector<int>& SolutionCollector::Unperformed(
|
||||
int n, SequenceVar* const v) const {
|
||||
return solutions_[n]->Unperformed(v);
|
||||
}
|
||||
|
||||
namespace {
|
||||
// ----- First Solution Collector -----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user