Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ algorithms/

operations_research::BaseKnapsackSolver Class Reference

BaseKnapsackSolver This the base class for knapsack solvers. More...

#include <knapsack_solver.h>

Inheritance diagram for operations_research::BaseKnapsackSolver:

operations_research::Knapsack64ItemsSolver operations_research::KnapsackBruteForceSolver operations_research::KnapsackDynamicProgrammingSolver operations_research::KnapsackGenericSolver operations_research::KnapsackMIPSolver

List of all members.

Public Member Functions

 BaseKnapsackSolver (const string &solver_name)
virtual ~BaseKnapsackSolver ()
virtual void Init (const std::vector< int64 > &profits, const std::vector< std::vector< int64 > > &weights, const std::vector< int64 > &capacities)=0
 Initializes the solver and enters the problem to be solved.
virtual void GetLowerAndUpperBoundWhenItem (int item_id, bool is_item_in, int64 *lower_bound, int64 *upper_bound)
 Gets the lower and upper bound when the item is in or out of the knapsack.
virtual int64 Solve ()=0
 Solves the problem and returns the profit of the optimal solution.
virtual bool best_solution (int item_id) const =0
 Returns true if the item 'item_id' is packed in the optimal knapsack.
virtual string GetName () const


Detailed Description

BaseKnapsackSolver This the base class for knapsack solvers.

Definition at line 469 of file knapsack_solver.h.


Constructor & Destructor Documentation

operations_research::BaseKnapsackSolver::BaseKnapsackSolver ( const string &  solver_name  )  [inline, explicit]

Definition at line 471 of file knapsack_solver.h.

virtual operations_research::BaseKnapsackSolver::~BaseKnapsackSolver (  )  [inline, virtual]

Definition at line 473 of file knapsack_solver.h.


Member Function Documentation

virtual void operations_research::BaseKnapsackSolver::Init ( const std::vector< int64 > &  profits,
const std::vector< std::vector< int64 > > &  weights,
const std::vector< int64 > &  capacities 
) [pure virtual]

void operations_research::BaseKnapsackSolver::GetLowerAndUpperBoundWhenItem ( int  item_id,
bool  is_item_in,
int64 *  lower_bound,
int64 *  upper_bound 
) [virtual]

Gets the lower and upper bound when the item is in or out of the knapsack.

BaseKnapsackSolver.

To ensure objects are correctly initialized, this method should not be called before Init.

Reimplemented in operations_research::KnapsackGenericSolver.

Definition at line 1311 of file knapsack_solver.cc.

virtual int64 operations_research::BaseKnapsackSolver::Solve (  )  [pure virtual]

virtual bool operations_research::BaseKnapsackSolver::best_solution ( int  item_id  )  const [pure virtual]

virtual string operations_research::BaseKnapsackSolver::GetName (  )  const [inline, virtual]

Definition at line 494 of file knapsack_solver.h.


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