Loading...
Searching...
No Matches
CglLandPUtils.hpp
Go to the documentation of this file.
// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
// Author: Pierre Bonami
// LIF
// CNRS, Aix-Marseille Universites
// Date: 02/23/08
//
// $Id$
//
// This code is licensed under the terms of the Eclipse Public License (EPL).
//---------------------------------------------------------------------------
#ifndef CglLandPUtils_H
#define CglLandPUtils_H
#include "CglLandPTabRow.hpp"
class CoinRelFltEq;
class OsiRowCut;
class OsiCuts;
#include <vector>
#include <cmath>
namespace LAP
{
double normCoef(TabRow &row, int ncols, const int * nonBasics);
void scale(OsiRowCut &cut);
void scale(OsiRowCut &cut, double norma);
void modularizeRow(TabRow & row, const bool * integerVar);
inline double intersectionCutCoef(double alpha_i, double beta)
{
if (alpha_i>0) return alpha_i* (1 - beta);
else return -alpha_i * beta;// (1 - beta);
}
inline double modularizedCoef(double alpha, double beta)
{
double f_i = alpha - floor(alpha);
if (f_i <= beta)
return f_i;
else
return f_i - 1;
}
inline bool int_val(double value, double tol)
{
return fabs( floor( value + 0.5 ) - value ) < tol;
}
struct Cuts
{
Cuts(): numberCuts_(0), cuts_(0)
{
}
int insertAll(OsiCuts & cs, CoinRelFltEq& eq);
~Cuts() {}
OsiRowCut * rowCut(unsigned int i)
{
return cuts_[i];
}
const OsiRowCut * rowCut(unsigned int i) const
{
return cuts_[i];
}
void insert(int i, OsiRowCut * cut);
int numberCuts()
{
return numberCuts_;
}
void resize(unsigned int i)
{
cuts_.resize(i, static_cast<OsiRowCut *> (NULL));
}
private:
int numberCuts_;
std::vector<OsiRowCut *> cuts_;
};
}
#endif
CglLandPTabRow.hpp
LAP
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition CglLandP.hpp:25
LAP::modularizedCoef
double modularizedCoef(double alpha, double beta)
compute the modularized row coefficient for an integer variable
Definition CglLandPUtils.hpp:42
LAP::int_val
bool int_val(double value, double tol)
Says is value is integer.
Definition CglLandPUtils.hpp:52
LAP::intersectionCutCoef
double intersectionCutCoef(double alpha_i, double beta)
return the coefficients of the intersection cut
Definition CglLandPUtils.hpp:35
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::modularizeRow
void modularizeRow(TabRow &row, const bool *integerVar)
Modularize row.
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
LAP::Cuts::rowCut
OsiRowCut * rowCut(unsigned int i)
Access to row cut indexed by i.
Definition CglLandPUtils.hpp:69
LAP::Cuts::insert
void insert(int i, OsiRowCut *cut)
insert a cut for variable i and count number of cuts.
LAP::Cuts::numberCuts_
int numberCuts_
Stores the number of cuts.
Definition CglLandPUtils.hpp:92
LAP::Cuts::resize
void resize(unsigned int i)
resize vector.
Definition CglLandPUtils.hpp:86
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::numberCuts
int numberCuts()
Access to number of cuts.
Definition CglLandPUtils.hpp:81
LAP::Cuts::insertAll
int insertAll(OsiCuts &cs, CoinRelFltEq &eq)
Puts all the cuts into an OsiCuts.
LAP::Cuts::~Cuts
~Cuts()
Destructor.
Definition CglLandPUtils.hpp:67
LAP::TabRow
Definition CglLandPTabRow.hpp:22
cut
Definition Cgl012cut.hpp:153