![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
#include <assignment.h>
Public Member Functions | |
SetCoverAssignment (const SetCoverModel &m) | |
void | Clear () |
Clears the current assignment. | |
void | AttachInvariant (SetCoverInvariant *i) |
void | AttachInvariant (CapacityInvariant *i) |
Cost | cost () const |
Returns the cost of current solution. | |
const SubsetBoolVector & | assignment () const |
Returns the subset assignment vector. | |
void | SetValue (SubsetIndex subset, bool is_selected, SetCoverInvariant::ConsistencyLevel set_cover_consistency) |
Sets the subset's assignment to the given bool. | |
SetCoverSolutionResponse | ExportSolutionAsProto () const |
Returns the current solution as a proto. | |
void | LoadAssignment (const SubsetBoolVector &solution) |
void | ImportSolutionFromProto (const SetCoverSolutionResponse &message) |
bool | CheckConsistency () const |
SetCoverAssignment stores a possibly partial, possibly infeasible solution to a SetCoverModel. It only stores a solution and no metadata, so that it can be shared efficiently among constraints.
This class is equivalent to an Assignment object in the CP/routing solver. (//ortools/routing).
Definition at line 32 of file assignment.h.
|
inlineexplicit |
Constructs an empty set covering assignment.
The model size or costs must not change after the invariant was built. The caller must guarantee that the model outlives the assignment without changing its costs.
Definition at line 39 of file assignment.h.
|
inline |
Returns the subset assignment vector.
Definition at line 57 of file assignment.h.
void operations_research::SetCoverAssignment::AttachInvariant | ( | CapacityInvariant * | i | ) |
Definition at line 40 of file assignment.cc.
void operations_research::SetCoverAssignment::AttachInvariant | ( | SetCoverInvariant * | i | ) |
Adds a constraint to the problem. At least one set-covering constraint is required; use side constraints as required (no set-covering constraint can be a side constraint).
Definition at line 35 of file assignment.cc.
bool operations_research::SetCoverAssignment::CheckConsistency | ( | ) | const |
Checks the consistency of the solution (between the selected subsets and the solution cost).
Definition at line 109 of file assignment.cc.
void operations_research::SetCoverAssignment::Clear | ( | ) |
Clears the current assignment.
Definition at line 26 of file assignment.cc.
|
inline |
Returns the cost of current solution.
Definition at line 54 of file assignment.h.
SetCoverSolutionResponse operations_research::SetCoverAssignment::ExportSolutionAsProto | ( | ) | const |
Returns the current solution as a proto.
Definition at line 77 of file assignment.cc.
void operations_research::SetCoverAssignment::ImportSolutionFromProto | ( | const SetCoverSolutionResponse & | message | ) |
Imports the solution from a proto.
The given assignment must fit the model of this assignment.
Definition at line 96 of file assignment.cc.
void operations_research::SetCoverAssignment::LoadAssignment | ( | const SubsetBoolVector & | solution | ) |
Loads the solution and recomputes the data in the invariant.
The given assignment must fit the model of this assignment.
Definition at line 90 of file assignment.cc.
void operations_research::SetCoverAssignment::SetValue | ( | SubsetIndex | subset, |
bool | is_selected, | ||
SetCoverInvariant::ConsistencyLevel | set_cover_consistency ) |
Sets the subset's assignment to the given bool.
Definition at line 47 of file assignment.cc.