![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
#include <set_cover_heuristics.h>
Public Member Functions | |
SubsetListBasedSolutionGenerator (SetCoverInvariant *inv, SetCoverInvariant::ConsistencyLevel consistency_level, absl::string_view class_name, absl::string_view name) | |
bool | NextSolution (absl::Span< const SubsetIndex > _) override |
bool | NextSolution () final |
Virtual methods that must be implemented by derived classes. | |
bool | NextSolution (const SubsetBoolVector &in_focus) final |
Same as above, but with a vector of Booleans as focus. | |
Public Member Functions inherited from operations_research::SetCoverSolutionGenerator | |
SetCoverSolutionGenerator (SetCoverInvariant *inv, SetCoverInvariant::ConsistencyLevel consistency_level, absl::string_view class_name, absl::string_view name) | |
virtual | ~SetCoverSolutionGenerator ()=default |
void | SetName (const absl::string_view name) |
SetCoverInvariant * | inv () const |
virtual SetCoverSolutionGenerator & | ResetLimits () |
Resets the limits to their default values. | |
SetCoverSolutionGenerator & | SetMaxIterations (int64_t max_iterations) |
Sets the maximum number of iterations. | |
int64_t | max_iterations () const |
Returns the maximum number of iterations. | |
SetCoverSolutionGenerator & | SetTimeLimitInSeconds (double seconds) |
Sets the time limit in seconds. | |
absl::Duration | run_time () const |
double | run_time_in_seconds () const |
Returns the total elapsed runtime in seconds. | |
double | run_time_in_microseconds () const |
Returns the total elapsed runtime in microseconds. | |
std::string | name () const |
Returns the name of the heuristic. | |
std::string | class_name () const |
Returns the name of the class. | |
Cost | cost () const |
Returns the current cost of the solution in the invariant. | |
bool | CheckInvariantConsistency () const |
Additional Inherited Members | |
Protected Member Functions inherited from operations_research::SetCoverSolutionGenerator | |
SetCoverModel * | model () const |
Accessors. | |
BaseInt | num_subsets () const |
double | time_limit_in_seconds () const |
The time limit in seconds. | |
Protected Attributes inherited from operations_research::SetCoverSolutionGenerator | |
absl::Duration | run_time_ |
run_time_ is an abstract duration for the time spent in NextSolution(). | |
SetCoverInvariant::ConsistencyLevel | consistency_level_ |
The consistency needed by the solution generator. |
Now we define two classes that are used to implement the solution generators. The first one uses a vector of subset indices as focus, while the second one uses a vector of Booleans. This makes the declaration of the solution generators shorter, more readable and improves type correctness. The class of solution generators that use a vector of subset indices as focus, with a transformation from a vector of Booleans to a vector of subset indices if needed.
Definition at line 171 of file set_cover_heuristics.h.
|
inlineexplicit |
Definition at line 173 of file set_cover_heuristics.h.
|
inlinefinalvirtual |
Virtual methods that must be implemented by derived classes.
Computes the next full solution taking into account all the subsets.
Implements operations_research::SetCoverSolutionGenerator.
Reimplemented in operations_research::TrivialSolutionGenerator.
Definition at line 181 of file set_cover_heuristics.h.
|
inlineoverridevirtual |
Computes the next partial solution considering only the subsets whose indices are in focus.
Implements operations_research::SetCoverSolutionGenerator.
Reimplemented in operations_research::TrivialSolutionGenerator.
Definition at line 179 of file set_cover_heuristics.h.
|
inlinefinalvirtual |
Same as above, but with a vector of Booleans as focus.
Implements operations_research::SetCoverSolutionGenerator.
Reimplemented in operations_research::TrivialSolutionGenerator.
Definition at line 183 of file set_cover_heuristics.h.