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_).
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.
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_).
[[["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\u003e\u003ccode\u003eSharedSolutionRepository\u003c/code\u003e is a class in C++ that manages a pool of solutions.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to add, retrieve, and synchronize solutions.\u003c/p\u003e\n"],["\u003cp\u003eThe repository maintains a stable ordering of solutions and allows access to individual variable values within a solution.\u003c/p\u003e\n"],["\u003cp\u003eUsers can obtain a random solution biased towards better solutions using \u003ccode\u003eGetRandomBiasedSolution\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe repository stores a limited number of solutions determined during initialization.\u003c/p\u003e\n"]]],["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,["# SharedSolutionRepository\n\nC++ Reference: class SharedSolutionRepository\n=============================================\n\n\nNote: This documentation is automatically generated.\n\n| Method ||\n|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`Add`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L108) | 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_). |\n| [`GetRandomBiasedSolution`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L102) | Return type: `Solution ` Arguments: `absl::BitGenRef random` Returns a random solution biased towards good solutions. |\n| [`GetSolution`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L94) | Return type: `Solution ` Arguments: `int index` Returns the solution #i where i must be smaller than NumSolutions(). |\n| [`GetVariableValueInSolution`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L99) | 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. |\n| [`NumSolutions`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L91) | Return type: `int ` Returns the number of current solution in the pool. This will never decrease. |\n| [`SharedSolutionRepository`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L57) | Return type: `explicit ` Arguments: `int num_solutions_to_keep` \u003cbr /\u003e |\n| [`Synchronize`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/synchronization.h#L116) | 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_). |"]]