Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: CglLandPUtils.hpp 1122 2013-04-06 20:39:53Z stefan $
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 {
61 Cuts(): numberCuts_(0), cuts_(0)
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, reinterpret_cast<OsiRowCut *> (NULL));
89 }
90 private:
92 int numberCuts_;
94 std::vector<OsiRowCut *> cuts_;
95 };
96
97 }
98 #endif
99
LAP::modularizedCoef
double modularizedCoef(double alpha, double beta)
compute the modularized row coefficient for an integer variable
Definition: CglLandPUtils.hpp:42
LAP::Cuts::resize
void resize(unsigned int i)
resize vector.
Definition: CglLandPUtils.hpp:86
LAP::Cuts::numberCuts_
int numberCuts_
Stores the number of cuts.
Definition: CglLandPUtils.hpp:92
LAP::Cuts::insertAll
int insertAll(OsiCuts &cs, CoinRelFltEq &eq)
Puts all the cuts into an OsiCuts.
LAP::modularizeRow
void modularizeRow(TabRow &row, const bool *integerVar)
Modularize row.
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
LAP::normCoef
double normCoef(TabRow &row, int ncols, const int *nonBasics)
Compute $ {{j=1}^n | a_{ij} |}{1 - a_{i0}} $ for row passed as argument.
LAP::Cuts::rowCut
OsiRowCut * rowCut(unsigned int i)
Access to row cut indexed by i.
Definition: CglLandPUtils.hpp:69
CglLandPTabRow.hpp
CoinRelFltEq
Equality to a scaled tolerance.
Definition: CoinFloatEqual.hpp:120
cut
Definition: Cgl012cut.hpp:153
LAP::intersectionCutCoef
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
Definition: CglLandPUtils.hpp:35
LAP::int_val
bool int_val(double value, double tol)
Says is value is integer.
Definition: CglLandPUtils.hpp:52
LAP::scale
void scale(OsiRowCut &cut)
scale the cut passed as argument
LAP::Cuts::rowCut
const OsiRowCut * rowCut(unsigned int i) const
const access to row cut indexed by i
Definition: CglLandPUtils.hpp:74
OsiRowCut
Row Cut Class.
Definition: OsiRowCut.hpp:29
LAP::Cuts::numberCuts
int numberCuts()
Access to number of cuts.
Definition: CglLandPUtils.hpp:81
LAP::Cuts::cuts_
std::vector< OsiRowCut * > cuts_
Store the cuts by index of the generating simple disjunction.
Definition: CglLandPUtils.hpp:94
LAP::Cuts::Cuts
Cuts()
Definition: CglLandPUtils.hpp:61
LAP::Cuts
To store extra cuts generated by columns from which they origin.
Definition: CglLandPUtils.hpp:59
LAP::Cuts::~Cuts
~Cuts()
Destructor.
Definition: CglLandPUtils.hpp:67
LAP::Cuts::insert
void insert(int i, OsiRowCut *cut)
insert a cut for variable i and count number of cuts.