coin-Bcp
Public Member Functions | List of all members
BCP_solution_generic Class Reference

This class holds a MIP feasible primal solution. More...

#include <BCP_solution.hpp>

Inheritance diagram for BCP_solution_generic:
Inheritance graph
[legend]
Collaboration diagram for BCP_solution_generic:
Collaboration graph
[legend]

Public Member Functions

 BCP_solution_generic (bool delvars=true)
 The default constructor creates a solution with zero objective value. More...
 
virtual ~BCP_solution_generic ()
 The destructor deletes the data members. More...
 
virtual double objective_value () const
 Return the objective value of the solution. More...
 
void set_objective_value (double v)
 Set the objective value of the solution. More...
 
void display () const
 Display the solution. More...
 
void add_entry (BCP_var *var, double value)
 Append a variable and the corresponding value to the end of the appropriate vectors. More...
 
- Public Member Functions inherited from BCP_solution
virtual ~BCP_solution ()
 The virtual destructor ensures that the correct destructor is invoked. More...
 

Public Attributes

Data members
double _objective
 The objective value of the solution. More...
 
bool _delete_vars
 An indicator to show whether the pointers in _vars should be deleted upon destruction or not. More...
 
BCP_vec< BCP_var * > _vars
 Vector of variables that are at nonzero level in the solution. More...
 
BCP_vec< double > _values
 Values of these variables in the solution. More...
 

Detailed Description

This class holds a MIP feasible primal solution.

The default BCP_lp_user::pack_feasible_solution() uses this class to pack an MIP feasible solution, but the user can use this class (instead of using BCP_solution as a base class to derive a different solution holder. (This might be necessary if, for example, the dual values are of importance as well.) The virtual destructor and virtual member functions make this easy.

Definition at line 33 of file BCP_solution.hpp.

Constructor & Destructor Documentation

BCP_solution_generic::BCP_solution_generic ( bool  delvars = true)
inline

The default constructor creates a solution with zero objective value.

Definition at line 50 of file BCP_solution.hpp.

virtual BCP_solution_generic::~BCP_solution_generic ( )
inlinevirtual

The destructor deletes the data members.

Note that it purges _vars (i.e., deletes the variables the pointers in _vars point to) only if the _delete_vars member is true.

Definition at line 55 of file BCP_solution.hpp.

References _delete_vars, _vars, and purge_ptr_vector().

Member Function Documentation

virtual double BCP_solution_generic::objective_value ( ) const
inlinevirtual

Return the objective value of the solution.

Implements BCP_solution.

Definition at line 61 of file BCP_solution.hpp.

References _objective.

void BCP_solution_generic::set_objective_value ( double  v)
inline

Set the objective value of the solution.

Definition at line 64 of file BCP_solution.hpp.

References _objective.

void BCP_solution_generic::display ( ) const

Display the solution.

void BCP_solution_generic::add_entry ( BCP_var var,
double  value 
)
inline

Append a variable and the corresponding value to the end of the appropriate vectors.

This method is used when unpacking the solution.

Definition at line 71 of file BCP_solution.hpp.

References _objective, _values, _vars, BCP_var::obj(), and BCP_vec< T >::push_back().

Member Data Documentation

double BCP_solution_generic::_objective

The objective value of the solution.

Definition at line 38 of file BCP_solution.hpp.

Referenced by add_entry(), objective_value(), and set_objective_value().

bool BCP_solution_generic::_delete_vars

An indicator to show whether the pointers in _vars should be deleted upon destruction or not.

By default they are not.

Definition at line 41 of file BCP_solution.hpp.

Referenced by ~BCP_solution_generic().

BCP_vec<BCP_var*> BCP_solution_generic::_vars

Vector of variables that are at nonzero level in the solution.

Definition at line 43 of file BCP_solution.hpp.

Referenced by add_entry(), and ~BCP_solution_generic().

BCP_vec<double> BCP_solution_generic::_values

Values of these variables in the solution.

Definition at line 45 of file BCP_solution.hpp.

Referenced by add_entry().


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