Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::SetCoverAssignment Class Reference

#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 SubsetBoolVectorassignment () 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

Detailed Description

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.

Constructor & Destructor Documentation

◆ SetCoverAssignment()

operations_research::SetCoverAssignment::SetCoverAssignment ( const SetCoverModel & m)
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.

Member Function Documentation

◆ assignment()

const SubsetBoolVector & operations_research::SetCoverAssignment::assignment ( ) const
inline

Returns the subset assignment vector.

Definition at line 57 of file assignment.h.

◆ AttachInvariant() [1/2]

void operations_research::SetCoverAssignment::AttachInvariant ( CapacityInvariant * i)
Todo
(user): call i->SetAssignment or similar so that each and every constraint uses the same solution storage.

Definition at line 40 of file assignment.cc.

◆ AttachInvariant() [2/2]

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.

◆ CheckConsistency()

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.

◆ Clear()

void operations_research::SetCoverAssignment::Clear ( )

Clears the current assignment.

Definition at line 26 of file assignment.cc.

◆ cost()

Cost operations_research::SetCoverAssignment::cost ( ) const
inline

Returns the cost of current solution.

Definition at line 54 of file assignment.h.

◆ ExportSolutionAsProto()

SetCoverSolutionResponse operations_research::SetCoverAssignment::ExportSolutionAsProto ( ) const

Returns the current solution as a proto.

Definition at line 77 of file assignment.cc.

◆ ImportSolutionFromProto()

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.

◆ LoadAssignment()

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.

◆ SetValue()

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.


The documentation for this class was generated from the following files: