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

#include <constraint_solveri.h>

Inheritance diagram for operations_research::LocalSearchFilterManager:
operations_research::BaseObject

Classes

struct  FilterEvent
 

Public Types

enum  FilterEventType { kAccept , kRelax }
 

Public Member Functions

std::string DebugString () const override
 
 LocalSearchFilterManager (std::vector< FilterEvent > filter_events)
 
 LocalSearchFilterManager (std::vector< LocalSearchFilter * > filters)
 
void Revert ()
 Calls Revert() of filters, in reverse order of Relax events.
 
bool Accept (LocalSearchMonitor *monitor, const Assignment *delta, const Assignment *deltadelta, int64_t objective_min, int64_t objective_max)
 
void Synchronize (const Assignment *assignment, const Assignment *delta)
 Synchronizes all filters to assignment.
 
int64_t GetSynchronizedObjectiveValue () const
 
int64_t GetAcceptedObjectiveValue () const
 
- Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 

Detailed Description

Filter manager: when a move is made, filters are executed to decide whether the solution is feasible and compute parts of the new cost. This class schedules filter execution and composes costs as a sum.

Definition at line 2115 of file constraint_solveri.h.

Member Enumeration Documentation

◆ FilterEventType

This class is responsible for calling filters methods in a correct order. For now, an order is specified explicitly by the user.

Enumerator
kAccept 
kRelax 

Definition at line 2119 of file constraint_solveri.h.

Constructor & Destructor Documentation

◆ LocalSearchFilterManager() [1/2]

operations_research::LocalSearchFilterManager::LocalSearchFilterManager ( std::vector< FilterEvent > filter_events)
explicit

Builds a manager that calls filter methods ordered by increasing priority.

Note
some filters might appear only once, if their Relax() or Accept() are trivial.

Definition at line 4634 of file local_search.cc.

◆ LocalSearchFilterManager() [2/2]

operations_research::LocalSearchFilterManager::LocalSearchFilterManager ( std::vector< LocalSearchFilter * > filters)
explicit

Builds a manager that calls filter methods using the following ordering: first Relax() in vector order, then Accept() in vector order.

Definition at line 4619 of file local_search.cc.

Member Function Documentation

◆ Accept()

bool operations_research::LocalSearchFilterManager::Accept ( LocalSearchMonitor * monitor,
const Assignment * delta,
const Assignment * deltadelta,
int64_t objective_min,
int64_t objective_max )

Returns true iff all filters return true, and the sum of their accepted objectives is between objective_min and objective_max. The monitor has its Begin/EndFiltering events triggered.

Todo
(user): the behaviour of Accept relies on the initial order of filters having at most one filter with negative objective values, this could be fixed by having filters return their general bounds.
Todo
(user): handle objective min.

Bump up rejected event, together with its kRelax event, unless it is already first in its priority layer.

Definition at line 4659 of file local_search.cc.

◆ DebugString()

std::string operations_research::LocalSearchFilterManager::DebugString ( ) const
inlineoverridevirtual

Reimplemented from operations_research::BaseObject.

Definition at line 2126 of file constraint_solveri.h.

◆ GetAcceptedObjectiveValue()

int64_t operations_research::LocalSearchFilterManager::GetAcceptedObjectiveValue ( ) const
inline

Definition at line 2148 of file constraint_solveri.h.

◆ GetSynchronizedObjectiveValue()

int64_t operations_research::LocalSearchFilterManager::GetSynchronizedObjectiveValue ( ) const
inline

Definition at line 2147 of file constraint_solveri.h.

◆ Revert()

void operations_research::LocalSearchFilterManager::Revert ( )

Calls Revert() of filters, in reverse order of Relax events.

Filters' Revert() must be called in the reverse order in which their Relax() was called.

Definition at line 4648 of file local_search.cc.

◆ Synchronize()

void operations_research::LocalSearchFilterManager::Synchronize ( const Assignment * assignment,
const Assignment * delta )

Synchronizes all filters to assignment.

If delta is nullptr or empty, then assignment may be a partial solution. Send a signal to Relaxing filters to inform them, so they can show the partial solution as a change from the empty solution.

Relax in the forward direction.

Synchronize/Commit backwards, so filters can read changes from their dependencies before those are synchronized/committed.

Definition at line 4715 of file local_search.cc.


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