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

Detailed Description

Definition at line 38 of file shaving_solver.h.

#include <shaving_solver.h>

Inheritance diagram for operations_research::sat::ObjectiveShavingSolver:
operations_research::sat::SubSolver

Public Member Functions

 ObjectiveShavingSolver (const SatParameters &local_parameters, NeighborhoodGeneratorHelper *helper, SharedClasses *shared)
 ~ObjectiveShavingSolver () override
bool TaskIsAvailable () override
std::function< void()> GenerateTask (int64_t task_id) override
void Synchronize () override
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 NotifySelection ()
void AddTaskDeterministicDuration (double deterministic_duration)
std::string TimingInfo () const
std::string DeterministicTimingInfo () const
double GetSelectionScore (bool deterministic) const

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ ObjectiveShavingSolver()

operations_research::sat::ObjectiveShavingSolver::ObjectiveShavingSolver ( const SatParameters & local_parameters,
NeighborhoodGeneratorHelper * helper,
SharedClasses * shared )

Definition at line 49 of file shaving_solver.cc.

◆ ~ObjectiveShavingSolver()

operations_research::sat::ObjectiveShavingSolver::~ObjectiveShavingSolver ( )
override

Definition at line 58 of file shaving_solver.cc.

Member Function Documentation

◆ GenerateTask()

std::function< void()> operations_research::sat::ObjectiveShavingSolver::GenerateTask ( int64_t task_id)
overridevirtual

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 70 of file shaving_solver.cc.

◆ Synchronize()

void operations_research::sat::ObjectiveShavingSolver::Synchronize ( )
overridevirtual

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.

We are just waiting for the inner code to check the time limit or to return nicely.

Todo
(user): Also stop if we have enough newly fixed / improved root level bounds so that we think it is worth represolving and restarting.

The current objective lower bound has been improved, restarting.

A solution has been found that is better than the current target objective upper bound. Restarting to use a smaller delta.

If the range has been reduced enough to warrant a delta of 1, while the current search uses a delta > 1. Restarting to switch to the delta of 1.

Implements operations_research::sat::SubSolver.

Definition at line 112 of file shaving_solver.cc.

◆ TaskIsAvailable()

bool operations_research::sat::ObjectiveShavingSolver::TaskIsAvailable ( )
overridevirtual

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

We only support one task at the time.

Implements operations_research::sat::SubSolver.

Definition at line 62 of file shaving_solver.cc.


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