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

#include <routing_utils.h>

Classes

struct  LoadLimit
 

Public Member Functions

 BinCapacities (int num_bins)
 
void AddDimension (std::function< int64_t(int, int)> load_demand_of_item_for_bin, std::vector< LoadLimit > load_limit_per_bin)
 
int NumDimensions () const
 
bool CheckAdditionFeasibility (int item, int bin) const
 Checks whether adding item(s) is feasible w.r.t. dimensions.
 
bool CheckAdditionsFeasibility (const std::vector< int > &items, int bin) const
 
bool AddItemToBin (int item, int bin)
 
bool RemoveItemFromBin (int item, int bin)
 Removes item from bin, return whether the bin is feasible.
 
int64_t TotalCost () const
 Returns the total cost incurred by violating soft costs.
 
void ClearItemsOfBin (int bin)
 Removes all items from given bin, resets the total cost.
 
void ClearItems ()
 Removes all items from all bins.
 

Detailed Description

Tracks whether bins constrained by several nonnegative dimensions can contain items added incrementally. Also tracks soft violation costs.

Definition at line 26 of file routing_utils.h.

Constructor & Destructor Documentation

◆ BinCapacities()

operations_research::BinCapacities::BinCapacities ( int num_bins)
inlineexplicit

Definition at line 28 of file routing_utils.h.

Member Function Documentation

◆ AddDimension()

void operations_research::BinCapacities::AddDimension ( std::function< int64_t(int, int)> load_demand_of_item_for_bin,
std::vector< LoadLimit > load_limit_per_bin )

Definition at line 28 of file routing_utils.cc.

◆ AddItemToBin()

bool operations_research::BinCapacities::AddItemToBin ( int item,
int bin )

Adds item to bin, returns whether the bin is feasible. The item is still added even when infeasible.

Definition at line 63 of file routing_utils.cc.

◆ CheckAdditionFeasibility()

bool operations_research::BinCapacities::CheckAdditionFeasibility ( int item,
int bin ) const

Checks whether adding item(s) is feasible w.r.t. dimensions.

Definition at line 44 of file routing_utils.cc.

◆ CheckAdditionsFeasibility()

bool operations_research::BinCapacities::CheckAdditionsFeasibility ( const std::vector< int > & items,
int bin ) const
Todo
(user): try to reorder on failure, so that tight dimensions are checked first.

Definition at line 48 of file routing_utils.cc.

◆ ClearItems()

void operations_research::BinCapacities::ClearItems ( )

Removes all items from all bins.

Definition at line 114 of file routing_utils.cc.

◆ ClearItemsOfBin()

void operations_research::BinCapacities::ClearItemsOfBin ( int bin)

Removes all items from given bin, resets the total cost.

Definition at line 99 of file routing_utils.cc.

◆ NumDimensions()

int operations_research::BinCapacities::NumDimensions ( ) const
inline

Definition at line 50 of file routing_utils.h.

◆ RemoveItemFromBin()

bool operations_research::BinCapacities::RemoveItemFromBin ( int item,
int bin )

Removes item from bin, return whether the bin is feasible.

Definition at line 81 of file routing_utils.cc.

◆ TotalCost()

int64_t operations_research::BinCapacities::TotalCost ( ) const
inline

Returns the total cost incurred by violating soft costs.

Definition at line 61 of file routing_utils.h.


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