BCP_lp_pool.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #include "BCP_lp_pool.hpp"
4 
5 void
7  const double lhs = _row->dotProduct(lpres.x());
8  _violation = std::max<double>( 0.0,
9  std::max<double>(_row->LowerBound()-lhs,
10  lhs-_row->UpperBound()));
11 }
12 
13 int
15 {
16  iterator waiting_row = begin();
17  int cnt = 0;
18 
19  while (waiting_row != end()) {
20  if ((*waiting_row)->violation() <= etol) {
21  delete *waiting_row;
22  *waiting_row = back();
23  pop_back();
24  ++cnt;
25  } else {
26  ++waiting_row;
27  }
28  }
29  return cnt;
30 }
31 
32 //#############################################################################
33 
34 void
36 {
37  _red_cost = _col->Objective() - _col->dotProduct(lpres.pi());
38 }
39 
40 int
42 {
43  iterator waiting_col = begin();
44  int cnt = 0;
45 
46  while (waiting_col != end()) {
47  const double rc = (*waiting_col)->red_cost();
48  if (rc >= -etol) {
49  // printf("LP: removing col with rc: %e (etol: %e)\n", rc, etol);
50  delete *waiting_col;
51  *waiting_col = back();
52  pop_back();
53  ++cnt;
54  } else {
55  ++waiting_col;
56  }
57  }
58  return cnt;
59 }
60 
61 
62 //#############################################################################
63 
65 
66 //#############################################################################
67 
69 
70 //#############################################################################
71 
double LowerBound() const
Return the lower bound.
Definition: BCP_matrix.hpp:167
int remove_nonviolated(const double etol)
Definition: BCP_lp_pool.cpp:14
static bool _rows_are_valid
Definition: BCP_lp_pool.hpp:49
iterator begin()
Return an iterator to the beginning of the object.
Definition: BCP_vector.hpp:99
const double * x() const
static bool _cols_are_valid
reference back()
Return a reference to the last entry.
Definition: BCP_vector.hpp:133
void compute_red_cost(const BCP_lp_result &lpres)
Definition: BCP_lp_pool.cpp:35
void compute_violation(const BCP_lp_result &lpres)
Definition: BCP_lp_pool.cpp:6
int remove_positives(const double etol)
Definition: BCP_lp_pool.cpp:41
void pop_back()
Delete the last entry.
double Objective() const
Return the objective coefficient.
Definition: BCP_matrix.hpp:44
double UpperBound() const
Return the upper bound.
Definition: BCP_matrix.hpp:169
iterator end()
Return an iterator to the end of the object.
Definition: BCP_vector.hpp:104
const double * pi() const
This class holds the results after solving an LP relaxation.