Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::SynchronizationPoint Class Reference

A simple wrapper to add a synchronization point in the list of subsolvers. More...

#include <subsolver.h>

Inheritance diagram for operations_research::sat::SynchronizationPoint:
operations_research::sat::SubSolver

Public Member Functions

 SynchronizationPoint (absl::string_view name, std::function< void()> f)
 
bool TaskIsAvailable () final
 
std::function< void()> GenerateTask (int64_t) final
 
void Synchronize () final
 
- Public Member Functions inherited from operations_research::sat::SubSolver
 SubSolver (absl::string_view name, SubsolverType type)
 
virtual ~SubSolver ()=default
 
virtual bool IsDone ()
 
double deterministic_time () const
 
std::string name () const
 Returns the name of this SubSolver. Used in logs.
 
SubsolverType type () const
 Returns the type of the subsolver.
 
void AddTaskDuration (double duration_in_seconds)
 
void AddTaskDeterministicDuration (double deterministic_duration)
 
std::string TimingInfo () const
 
std::string DeterministicTimingInfo () const
 

Additional Inherited Members

- Public Types inherited from operations_research::sat::SubSolver
enum  SubsolverType { FULL_PROBLEM , FIRST_SOLUTION , INCOMPLETE , HELPER }
 

Detailed Description

A simple wrapper to add a synchronization point in the list of subsolvers.

Definition at line 140 of file subsolver.h.

Constructor & Destructor Documentation

◆ SynchronizationPoint()

operations_research::sat::SynchronizationPoint::SynchronizationPoint ( absl::string_view name,
std::function< void()> f )
inlineexplicit

Definition at line 142 of file subsolver.h.

Member Function Documentation

◆ GenerateTask()

std::function< void()> operations_research::sat::SynchronizationPoint::GenerateTask ( int64_t task_id)
inlinefinalvirtual

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.

This is only called by the main thread.

Implements operations_research::sat::SubSolver.

Definition at line 145 of file subsolver.h.

◆ Synchronize()

void operations_research::sat::SynchronizationPoint::Synchronize ( )
inlinefinalvirtual

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.

This is only called by the main thread in Subsolver creation order.

Implements operations_research::sat::SubSolver.

Definition at line 148 of file subsolver.h.

◆ TaskIsAvailable()

bool operations_research::sat::SynchronizationPoint::TaskIsAvailable ( )
inlinefinalvirtual

Returns true iff GenerateTask() can be called. This is only called by the main thread in a sequential fashion.

Implements operations_research::sat::SubSolver.

Definition at line 144 of file subsolver.h.


The documentation for this class was generated from the following file: