C++ Reference: class SubSolver

This documentation is automatically generated.

The API used for distributing work. Each subsolver can generate tasks and synchronize itself with the rest of the world.

Note that currently only the main thread interact with subsolvers. Only the tasks generated by GenerateTask() are executed in parallel in a threadpool.

Return type: double

Returns the total deterministic time spend by the completed tasks before the last Synchronize() call.


Return type: virtual std::function<void()>

Arguments: int64_t task_id

Returns a task to run. The task_id is just an ever increasing counter that correspond to the number of total calls to GenerateTask(). TODO(user): We could use a more complex selection logic and pass in the deterministic time limit this subtask should run for. Unclear at this stage.


Return type: std::string

Returns the name of this SubSolver. Used in logs.


Return type: double

Returns the score as updated by the completed tasks before the last Synchronize() call. Everything else being equal, we prefer to run a SubSolver with the highest score. TODO(user): This is unused for now.


Return type: explicit

Arguments: const std::string& name


Return type: virtual


Return type: virtual void

Synchronizes with the external world from this SubSolver point of view. Also incorporate the results of the latest completed tasks if any. Note(user): The intended implementation for determinism is that tasks update asynchronously (and so non-deterministically) global "shared" classes, but this global state is incorporated by the Subsolver only when Synchronize() is called.


Return type: virtual bool

Returns true iff GenerateTask() can be called. Note(user): In the current design, a SubSolver is never deleted until the end of the Solve() that created it. But is is okay to always return false here and release the memory used by the Subsolver internal if there is no need to call this Subsolver ever again. The overhead of iterating over it in the main solver loop should be minimal.