C++ Reference: class SearchReportingInterface

This documentation is automatically generated.

This class is used to abstract the interface to parallelism from the search code. It offers two sets of API:
   - Create specific search objects (Objective(), Limit()).
   - Report solution (SatSolution(), OptimizeSolution(), FinalOutput(), EndSearch(), BestSolution(), Interrupted(), Log(), Print()).


There will be only one SearchReporting class shared among all the solver threads.
Method
BestSolution

Return type: virtual int64

Returns the value of the best solution found during search.

CreateLimit

Return type: virtual SearchLimit*

Arguments: Solver* s, int thread_id

Creates a dedicated search limit. Each solver thread will get a different one.

CreateObjective

Return type: virtual OptimizeVar*

Arguments: Solver* s, bool maximize, IntVar* var, int64 step, int thread_id

Creates the objective used by the search. Each solver thread will get a different one.

Init

Return type: virtual void

Arguments: int thread_id, const std::string& init_string

Initialize the interface for a given thread id. In sequential mode, the thread id is always -1. In parallel mode, it ranges from 0 to num_threads - 1.

Interrupted

Return type: virtual bool

Returns true if the search was interrupted, usually by a time or solution limit.

Log

Return type: virtual void

Arguments: int thread_id, const std::string& message

Logs the message from the given thread.

MaxNumSolutions

Return type: int

Returns the limit on the number of solutions to find.

NumSolutions

Return type: int

Returns the number of solutions found.

OnOptimizeSolution

Return type: virtual void

Arguments: int thread_id, int64 value, const std::string& solution_string

Worker 'thread_id' notifies a new solution in an optimization problem. 'solution_string' is the solution to display if needed.

OnSatSolution

Return type: virtual void

Arguments: int thread_id, const std::string& solution_string

Worker 'thread_id' notifies a new solution in a satisfaction problem. 'solution_string' is the solution to display if needed.

OnSearchEnd

Return type: virtual void

Arguments: int thread_id, bool interrupted

Callback on the end search event.

OnSearchStart

Return type: virtual void

Arguments: int thread_id, Type type

Callback on the start search event.

Print

Return type: virtual void

Arguments: int thread_id, const std::string& output

Prints message to std::cout and adds a std::endl at the end. The minizinc specifications indicates that solutions and search status must be printed to std::cout.

SearchReportingInterface

Arguments: bool print_all, int max_num_solutions

~SearchReportingInterface

Return type: virtual

ShouldFinish

Return type: virtual bool

Checks if we should finish the search right away, for instance, in a satisfaction problem if a solution has already be found.

ShouldPrintAllSolutions

Return type: bool

Indicates if we should print all solutions.

Send feedback about...