Cgl  0.60.7
CglLandPUtils.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
2 // Author: Pierre Bonami
3 // LIF
4 // CNRS, Aix-Marseille Universites
5 // Date: 02/23/08
6 //
7 // $Id$
8 //
9 // This code is licensed under the terms of the Eclipse Public License (EPL).
10 //---------------------------------------------------------------------------
11 
12 #ifndef CglLandPUtils_H
13 #define CglLandPUtils_H
14 #include "CglLandPTabRow.hpp"
15 
16 class CoinRelFltEq;
17 class OsiRowCut;
18 class OsiCuts;
19 #include <vector>
20 #include <cmath>
21 
22 namespace LAP
23 {
25 double normCoef(TabRow &row, int ncols, const int * nonBasics);
27 void scale(OsiRowCut &cut);
29 void scale(OsiRowCut &cut, double norma);
31 void modularizeRow(TabRow & row, const bool * integerVar);
32 
33 
35 inline double intersectionCutCoef(double alpha_i, double beta)
36 {
37  if (alpha_i>0) return alpha_i* (1 - beta);
38  else return -alpha_i * beta;// (1 - beta);
39 }
40 
42 inline double modularizedCoef(double alpha, double beta)
43 {
44  double f_i = alpha - floor(alpha);
45  if (f_i <= beta)
46  return f_i;
47  else
48  return f_i - 1;
49 }
50 
52 inline bool int_val(double value, double tol)
53 {
54  return fabs( floor( value + 0.5 ) - value ) < tol;
55 }
56 
57 
59 struct Cuts
60 {
62  {
63  }
65  int insertAll(OsiCuts & cs, CoinRelFltEq& eq);
67  ~Cuts() {}
69  OsiRowCut * rowCut(unsigned int i)
70  {
71  return cuts_[i];
72  }
74  const OsiRowCut * rowCut(unsigned int i) const
75  {
76  return cuts_[i];
77  }
79  void insert(int i, OsiRowCut * cut);
81  int numberCuts()
82  {
83  return numberCuts_;
84  }
86  void resize(unsigned int i)
87  {
88  cuts_.resize(i, static_cast<OsiRowCut *> (NULL));
89  }
90 private:
94  std::vector<OsiRowCut *> cuts_;
95 };
96 
97 }
98 #endif
99 
LAP::Cuts::Cuts
Cuts()
Definition: CglLandPUtils.hpp:61
LAP::Cuts::numberCuts
int numberCuts()
Access to number of cuts.
Definition: CglLandPUtils.hpp:81
LAP::Cuts::~Cuts
~Cuts()
Destructor.
Definition: CglLandPUtils.hpp:67
LAP::intersectionCutCoef
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
Definition: CglLandPUtils.hpp:35
LAP::scale
void scale(OsiRowCut &cut)
scale the cut passed as argument
LAP::modularizeRow
void modularizeRow(TabRow &row, const bool *integerVar)
Modularize row.
LAP::Cuts::insert
void insert(int i, OsiRowCut *cut)
insert a cut for variable i and count number of cuts.
LAP::modularizedCoef
double modularizedCoef(double alpha, double beta)
compute the modularized row coefficient for an integer variable
Definition: CglLandPUtils.hpp:42
LAP::Cuts::cuts_
std::vector< OsiRowCut * > cuts_
Store the cuts by index of the generating simple disjunction.
Definition: CglLandPUtils.hpp:94
LAP::int_val
bool int_val(double value, double tol)
Says is value is integer.
Definition: CglLandPUtils.hpp:52
LAP::normCoef
double normCoef(TabRow &row, int ncols, const int *nonBasics)
Compute $ \frac{\sum\limits_{j=1}^n | \overline a_{ij} |}{1 - \overline a_{i0}} $ for row passed as a...
LAP::Cuts::insertAll
int insertAll(OsiCuts &cs, CoinRelFltEq &eq)
Puts all the cuts into an OsiCuts.
cut
Definition: Cgl012cut.hpp:153
LAP::Cuts::rowCut
const OsiRowCut * rowCut(unsigned int i) const
const access to row cut indexed by i
Definition: CglLandPUtils.hpp:74
LAP::Cuts::rowCut
OsiRowCut * rowCut(unsigned int i)
Access to row cut indexed by i.
Definition: CglLandPUtils.hpp:69
LAP::Cuts
To store extra cuts generated by columns from which they origin.
Definition: CglLandPUtils.hpp:59
LAP::Cuts::resize
void resize(unsigned int i)
resize vector.
Definition: CglLandPUtils.hpp:86
CglLandPTabRow.hpp
LAP::Cuts::numberCuts_
int numberCuts_
Stores the number of cuts.
Definition: CglLandPUtils.hpp:92
LAP
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition: CglLandP.hpp:24