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

Detailed Description

SubModelView provides a mechanism to interact with a subset of the rows and columns of a SetCoverModel, effectively creating a filtered view of the model. This abstraction allows operations to be performed on a restricted portion of the model without modifying the original data structure. The filtering is achieved using index lists and sizes vectors, which define the active rows and columns. This approach ensures flexibility and avoids unnecessary duplication of data. Columns/rows sizes are uses to both keep track of the number of elements in them and also provide the "activation" status: (item size == 0) <==> inactive SubModelView inherits from IndexListSubModelView, which provides the "view" machinery.

Definition at line 82 of file set_cover_submodel.h.

#include <set_cover_submodel.h>

Inheritance diagram for operations_research::scp::SubModelView:
operations_research::IndexListModelView

Public Member Functions

 SubModelView ()=default
 Empty initialization to facilitate delayed construction.
 SubModelView (const Model *model)
 Identity sub-model: all items are considered.
 SubModelView (const Model *model, const std::vector< FullSubsetIndex > &columns_focus)
 Focus construction: create a sub-model with only the required items.
virtual ~SubModelView ()=default
Cost fixed_cost () const
 Current fixed cost: sum of the cost of the fixed columns.
const std::vector< FullSubsetIndex > & fixed_columns () const
 List of fixed columns.
void SetFocus (const std::vector< FullSubsetIndex > &columns_focus)
virtual Cost FixMoreColumns (const std::vector< SubsetIndex > &columns_to_fix)
virtual void ResetColumnFixing (const std::vector< FullSubsetIndex > &columns_to_fix, const DualState &state)
virtual bool UpdateCore (Cost best_lower_bound, const ElementCostVector &best_multipliers, const Solution &best_solution, bool force)
StrongModelView StrongTypedFullModelView () const
Public Member Functions inherited from operations_research::IndexListModelView
 IndexListModelView ()=default
 IndexListModelView (const SetCoverModel *model, const SubsetToIntVector *cols_sizes, const ElementToIntVector *rows_sizes, const std::vector< SubsetIndex > *cols_focus, const std::vector< ElementIndex > *rows_focus)
BaseInt num_subsets () const
BaseInt num_elements () const
BaseInt num_focus_subsets () const
BaseInt num_focus_elements () const
auto subset_costs () const -> util_intops::IndexListView< Cost, SubsetIndex >
auto columns () const -> util_intops::TwoLevelsView< util_intops::IndexListView< SparseColumn, SubsetIndex >, ElementToIntVector >
auto rows () const -> util_intops::TwoLevelsView< util_intops::IndexListView< SparseRow, ElementIndex >, SubsetToIntVector >
const std::vector< SubsetIndex > & SubsetRange () const
const std::vector< ElementIndex > & ElementRange () const
FullElementIndex MapCoreToFullElementIndex (ElementIndex core_i) const
ElementIndex MapFullToCoreElementIndex (FullElementIndex full_i) const
FullSubsetIndex MapCoreToFullSubsetIndex (SubsetIndex core_j) const
BaseInt column_size (SubsetIndex j) const
BaseInt row_size (ElementIndex i) const
const SetCoverModelbase () const

Constructor & Destructor Documentation

◆ SubModelView() [1/3]

operations_research::scp::SubModelView::SubModelView ( )
default

Empty initialization to facilitate delayed construction.

◆ SubModelView() [2/3]

operations_research::scp::SubModelView::SubModelView ( const Model * model)

Identity sub-model: all items are considered.

Definition at line 22 of file set_cover_submodel.cc.

◆ SubModelView() [3/3]

operations_research::scp::SubModelView::SubModelView ( const Model * model,
const std::vector< FullSubsetIndex > & columns_focus )

Focus construction: create a sub-model with only the required items.

Definition at line 29 of file set_cover_submodel.cc.

◆ ~SubModelView()

virtual operations_research::scp::SubModelView::~SubModelView ( )
virtualdefault

Member Function Documentation

◆ fixed_columns()

const std::vector< FullSubsetIndex > & operations_research::scp::SubModelView::fixed_columns ( ) const
inline

List of fixed columns.

Definition at line 104 of file set_cover_submodel.h.

◆ fixed_cost()

Cost operations_research::scp::SubModelView::fixed_cost ( ) const
inline

Current fixed cost: sum of the cost of the fixed columns.

Definition at line 101 of file set_cover_submodel.h.

◆ FixMoreColumns()

Cost operations_research::scp::SubModelView::FixMoreColumns ( const std::vector< SubsetIndex > & columns_to_fix)
virtual

Fix the provided columns, removing them for the submodel. Rows now covered by fixed columns are also removed from the submodel along with non-fixed columns that only cover those rows.

Definition at line 57 of file set_cover_submodel.cc.

◆ ResetColumnFixing()

void operations_research::scp::SubModelView::ResetColumnFixing ( const std::vector< FullSubsetIndex > & columns_to_fix,
const DualState & state )
virtual

Definition at line 91 of file set_cover_submodel.cc.

◆ SetFocus()

void operations_research::scp::SubModelView::SetFocus ( const std::vector< FullSubsetIndex > & columns_focus)

Redefine the active items. The new sub-model will ignore all columns not in focus and (optionally) the rows for which row_flags is not true. It does not overwrite the current fixing.

Definition at line 101 of file set_cover_submodel.cc.

◆ StrongTypedFullModelView()

StrongModelView operations_research::scp::SubModelView::StrongTypedFullModelView ( ) const
inline

Definition at line 132 of file set_cover_submodel.h.

◆ UpdateCore()

virtual bool operations_research::scp::SubModelView::UpdateCore ( Cost best_lower_bound,
const ElementCostVector & best_multipliers,
const Solution & best_solution,
bool force )
inlinevirtual

Hook function for specializations. This function can be used to define a "small" core model considering a subset of the full model through the use of column-generation or by only selecting columns with good reduced cost in the full model.

Definition at line 126 of file set_cover_submodel.h.


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