Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class SharedSolutionRepository
Note: This documentation is automatically generated.
Method |
Add | Return type: void Arguments: const Solution& solution Add a new solution. Note that it will not be added to the pool of solution
right away. One must call Synchronize for this to happen.
Works in O(num_solutions_to_keep_).
|
GetRandomBiasedSolution | Return type: Solution Arguments: absl::BitGenRef random Returns a random solution biased towards good solutions.
|
GetSolution | Return type: Solution Arguments: int index Returns the solution #i where i must be smaller than NumSolutions().
|
GetVariableValueInSolution | Return type: ValueType Arguments: int var_index, int solution_index Returns the variable value of variable 'var_index' from solution
'solution_index' where solution_index must be smaller than NumSolutions()
and 'var_index' must be smaller than number of variables.
|
NumSolutions | Return type: int Returns the number of current solution in the pool. This will never
decrease.
|
SharedSolutionRepository | Return type: explicit Arguments: int num_solutions_to_keep |
Synchronize | Return type: void Updates the current pool of solution with the one recently added. Note that
we use a stable ordering of solutions, so the final pool will be
independent on the order of the calls to AddSolution() provided that the
set of added solutions is the same.
Works in O(num_solutions_to_keep_).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[],["The `SharedSolutionRepository` class manages a pool of solutions. Key actions include: adding a new solution via `Add`, which requires a subsequent `Synchronize` to update the pool. `NumSolutions` retrieves the current number of solutions. `GetSolution` fetches a specific solution by index. `GetRandomBiasedSolution` returns a random, quality-favored solution. `GetVariableValueInSolution` accesses a variable's value within a specified solution. The `Synchronize` method efficiently updates the solution pool, ensuring order stability. The class is constructed with `SharedSolutionRepository`, given the number of solutions to keep.\n"],null,[]]