Cgl 0.60.9
Loading...
Searching...
No Matches
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
16class CoinRelFltEq;
17class OsiRowCut;
18class OsiCuts;
19#include <vector>
20#include <cmath>
21
22namespace LAP
23{
25double normCoef(TabRow &row, int ncols, const int * nonBasics);
27void scale(OsiRowCut &cut);
29void scale(OsiRowCut &cut, double norma);
31void modularizeRow(TabRow & row, const bool * integerVar);
32
33
35inline 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
42inline 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
52inline bool int_val(double value, double tol)
53{
54 return fabs( floor( value + 0.5 ) - value ) < tol;
55}
56
57
59struct 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);
82 {
83 return numberCuts_;
84 }
86 void resize(unsigned int i)
87 {
88 cuts_.resize(i, static_cast<OsiRowCut *> (NULL));
89 }
90private:
94 std::vector<OsiRowCut *> cuts_;
95};
96
97}
98#endif
99
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition CglLandP.hpp:25
double modularizedCoef(double alpha, double beta)
compute the modularized row coefficient for an integer variable
bool int_val(double value, double tol)
Says is value is integer.
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
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...
void modularizeRow(TabRow &row, const bool *integerVar)
Modularize row.
void scale(OsiRowCut &cut)
scale the cut passed as argument
To store extra cuts generated by columns from which they origin.
const OsiRowCut * rowCut(unsigned int i) const
const access to row cut indexed by i
OsiRowCut * rowCut(unsigned int i)
Access to row cut indexed by i.
void insert(int i, OsiRowCut *cut)
insert a cut for variable i and count number of cuts.
int numberCuts_
Stores the number of cuts.
void resize(unsigned int i)
resize vector.
std::vector< OsiRowCut * > cuts_
Store the cuts by index of the generating simple disjunction.
int numberCuts()
Access to number of cuts.
int insertAll(OsiCuts &cs, CoinRelFltEq &eq)
Puts all the cuts into an OsiCuts.
~Cuts()
Destructor.