Class SolutionCollector


public class SolutionCollector extends SearchMonitor
This class is the root class of all solution collectors.
It implements a basic query API to be used independently
of the collector used.
  • Constructor Details

    • SolutionCollector

      public SolutionCollector(long cPtr, boolean cMemoryOwn)
    • SolutionCollector

      public SolutionCollector(Solver solver, Assignment assignment)
    • SolutionCollector

      public SolutionCollector(Solver solver)
  • Method Details

    • getCPtr

      public static long getCPtr(SolutionCollector obj)
    • swigRelease

      public static long swigRelease(SolutionCollector obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class SearchMonitor
    • delete

      public void delete()
      Overrides:
      delete in class SearchMonitor
    • install

      public void install()
      Description copied from class: SearchMonitor
      Registers itself on the solver such that it gets notified of the search
      and propagation events. Override to incrementally install listeners for
      specific events.
      Overrides:
      install in class SearchMonitor
    • toString

      public String toString()
      Overrides:
      toString in class BaseObject
    • add

      public void add(IntVar var)
      Add API.
    • add

      public void add(IntVar[] vars)
    • add

      public void add(IntervalVar var)
    • add

      public void add(IntervalVar[] vars)
    • add

      public void add(SequenceVar var)
    • add

      public void add(SequenceVar[] vars)
    • addObjective

      public void addObjective(IntVar objective)
    • AddObjectives

      public void AddObjectives(IntVar[] objectives)
    • enterSearch

      public void enterSearch()
      Beginning of the search.
      Overrides:
      enterSearch in class SearchMonitor
    • solutionCount

      public int solutionCount()
      Returns how many solutions were stored during the search.
    • has_solution

      public boolean has_solution()
      Returns whether any solutions were stored during the search.
    • solution

      public Assignment solution(int n)
      Returns the nth solution.
    • last_solution_or_null

      public Assignment last_solution_or_null()
      Returns the last solution if there are any, nullptr otherwise.
    • wallTime

      public long wallTime(int n)
      Returns the wall time in ms for the nth solution.
    • branches

      public long branches(int n)
      Returns the number of branches when the nth solution was found.
    • failures

      public long failures(int n)
      Returns the number of failures encountered at the time of the nth
      solution.
    • objectiveValue

      public long objectiveValue(int n)
      Returns the objective value of the nth solution.
    • ObjectiveValueFromIndex

      public long ObjectiveValueFromIndex(int n, int index)
      Returns the value of the index-th objective of the nth solution.
    • value

      public long value(int n, IntVar var)
      This is a shortcut to get the Value of 'var' in the nth solution.
    • startValue

      public long startValue(int n, IntervalVar var)
      This is a shortcut to get the StartValue of 'var' in the nth solution.
    • endValue

      public long endValue(int n, IntervalVar var)
      This is a shortcut to get the EndValue of 'var' in the nth solution.
    • durationValue

      public long durationValue(int n, IntervalVar var)
      This is a shortcut to get the DurationValue of 'var' in the nth solution.
    • performedValue

      public long performedValue(int n, IntervalVar var)
      This is a shortcut to get the PerformedValue of 'var' in the nth solution.
    • forwardSequence

      public int[] forwardSequence(int n, SequenceVar var)
      This is a shortcut to get the ForwardSequence of 'var' in the
      nth solution. The forward sequence is the list of ranked interval
      variables starting from the start of the sequence.
    • backwardSequence

      public int[] backwardSequence(int n, SequenceVar var)
      This is a shortcut to get the BackwardSequence of 'var' in the
      nth solution. The backward sequence is the list of ranked interval
      variables starting from the end of the sequence.
    • unperformed

      public int[] unperformed(int n, SequenceVar var)
      This is a shortcut to get the list of unperformed of 'var' in the
      nth solution.