Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class LocalSearchFilter
Note: This documentation is automatically generated.
Local Search Filters are used for fast neighbor pruning.
Filtering a move is done in several phases:
- in the Relax phase, filters determine which parts of their internals
will be changed by the candidate, and modify intermediary State
- in the Accept phase, filters check that the candidate is feasible,
- if the Accept phase succeeds, the solver may decide to trigger a
Synchronize phase that makes filters change their internal representation
to the last candidate,
- otherwise (Accept fails or the solver does not want to synchronize),
a Revert phase makes filters erase any intermediary State generated by the
Relax and Accept phases.
A given filter has phases called with the following pattern:
(Relax.Accept.Synchronize | Relax.Accept.Revert | Relax.Revert)*.
Filters's Revert() is always called in the reverse order their Accept() was
called, to allow late filters to use state done/undone by early filters'
Accept()/Revert().
Accepts a "delta" given the assignment with which the filter has been
synchronized; the delta holds the variables which have been modified and
their new value.
If the filter represents a part of the global objective, its contribution
must be between objective_min and objective_max.
Sample: supposing one wants to maintain a[0,1] + b[0,1] <= 1,
for the assignment (a,1), (b,0), the delta (b,1) will be rejected
but the delta (a,0) will be accepted.
TODO(user): Remove arguments when there are no more need for those.
Synchronizes the filter with the current solution, delta being the
difference with the solution passed to the previous call to Synchronize()
or IncrementalSynchronize(). 'delta' can be used to incrementally
synchronizing the filter with the new solution by only considering the
changes in delta.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eLocal Search Filters in C++ are employed for efficient neighbor pruning during the search process.\u003c/p\u003e\n"],["\u003cp\u003eFilters utilize a multi-phase approach (Relax, Accept, Synchronize/Revert) to evaluate and apply changes to the solution.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAccept\u003c/code\u003e phase is crucial for ensuring feasibility, while \u003ccode\u003eSynchronize\u003c/code\u003e updates the filter's internal state with accepted changes.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRevert\u003c/code\u003e is used to undo temporary modifications if a candidate solution is rejected or synchronization is not desired.\u003c/p\u003e\n"],["\u003cp\u003eFilters are designed to work incrementally, with methods like \u003ccode\u003eRelax\u003c/code\u003e and \u003ccode\u003eCommit\u003c/code\u003e facilitating communication and state management.\u003c/p\u003e\n"]]],["Local Search Filters perform neighbor pruning through phases: Relax, Accept, Synchronize, and Revert. Relax modifies an intermediary state based on a candidate move. Accept checks the candidate's feasibility. Synchronize updates the filter's internal state to match the last accepted candidate. Revert erases intermediary states if Accept fails or synchronization isn't needed. Filters' Revert() is called in reverse order of their Accept(). Key methods include: Accept, Commit, GetAcceptedObjectiveValue, GetSynchronizedObjectiveValue, Relax, Reset, Revert, Synchronize.\n"],null,["# LocalSearchFilter\n\nC++ Reference: class LocalSearchFilter\n======================================\n\n\nNote: This documentation is automatically generated.\nLocal Search Filters are used for fast neighbor pruning. Filtering a move is done in several phases: \n- in the Relax phase, filters determine which parts of their internals will be changed by the candidate, and modify intermediary State \n- in the Accept phase, filters check that the candidate is feasible, \n- if the Accept phase succeeds, the solver may decide to trigger a Synchronize phase that makes filters change their internal representation to the last candidate, \n- otherwise (Accept fails or the solver does not want to synchronize), a Revert phase makes filters erase any intermediary State generated by the Relax and Accept phases. \nA given filter has phases called with the following pattern: (Relax.Accept.Synchronize \\| Relax.Accept.Revert \\| Relax.Revert)\\*. Filters's Revert() is always called in the reverse order their Accept() was called, to allow late filters to use state done/undone by early filters' Accept()/Revert().\n\n| Method ||\n|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`Accept`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1747) | Return type: `virtual bool ` Arguments: `const Assignment* delta, const Assignment* deltadelta, int64_t objective_min, int64_t objective_max` Accepts a \"delta\" given the assignment with which the filter has been synchronized; the delta holds the variables which have been modified and their new value. If the filter represents a part of the global objective, its contribution must be between objective_min and objective_max. Sample: supposing one wants to maintain a\\[0,1\\] + b\\[0,1\\] \\\u003c= 1, for the assignment (a,1), (b,0), the delta (b,1) will be rejected but the delta (a,0) will be accepted. TODO(user): Remove arguments when there are no more need for those. |\n| [`Commit`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1736) | Return type: `virtual void ` Arguments: `const Assignment* delta, const Assignment* deltadelta` Dual of Relax(), lets the filter know that the delta was accepted. |\n| [`GetAcceptedObjectiveValue`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1768) | Return type: `virtual int64_t ` Objective value from the last time Accept() was called and returned true. If the last Accept() call returned false, returns an undefined value. |\n| [`GetSynchronizedObjectiveValue`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1765) | Return type: `virtual int64_t ` Objective value from last time Synchronize() was called. |\n| [`IsIncremental`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1749) | Return type: `virtual bool ` \u003cbr /\u003e |\n| [`Relax`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1734) | Return type: `virtual void ` Arguments: `const Assignment* delta, const Assignment* deltadelta` Lets the filter know what delta and deltadelta will be passed in the next Accept(). |\n| [`Reset`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1762) | Return type: `virtual void ` Sets the filter to empty solution. |\n| [`Revert`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1759) | Return type: `virtual void ` Cancels the changes made by the last Relax()/Accept() calls. |\n| [`Synchronize`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/constraint_solveri.h#L1756) | Return type: `virtual void ` Arguments: `const Assignment* assignment, const Assignment* delta` Synchronizes the filter with the current solution, delta being the difference with the solution passed to the previous call to Synchronize() or IncrementalSynchronize(). 'delta' can be used to incrementally synchronizing the filter with the new solution by only considering the changes in delta. |"]]