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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Cgl/src/CglLandP/CglLandPUtils.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2005-2009, Pierre Bonami and others.  All Rights Reserved.
    00002 // Author:   Pierre Bonami
    00003 //           LIF
    00004 //           CNRS, Aix-Marseille Universites
    00005 // Date:     02/23/08
    00006 //---------------------------------------------------------------------------
    00007
    00008 #ifndef CglLandPUtils_H
    00009 #define CglLandPUtils_H
    00010 #include "CglLandPTabRow.hpp"
    00011
    00012 class OsiRowCut;
    00013 class OsiCuts;
    00014 #include <vector>
    00015
    00016 namespace LAP
    00017 {
    00019 double normCoef(TabRow &row, int ncols, const int * nonBasics);
    00021 void scale(OsiRowCut &cut);
    00023 void scale(OsiRowCut &cut, double norma);
    00025 void modularizeRow(TabRow & row, const bool * integerVar);
    00026
    00027
    00029 inline double intersectionCutCoef(double alpha_i, double beta)
    00030 {
    00031     if (alpha_i>0) return alpha_i* (1 - beta);
    00032     else return -alpha_i * beta;// (1 - beta);
    00033 }
    00034
    00036 inline double modularizedCoef(double alpha, double beta)
    00037 {
    00038     double f_i = alpha - floor(alpha);
    00039     if (f_i <= beta)
    00040         return f_i;
    00041     else
    00042         return f_i - 1;
    00043 }
    00044
    00046 inline bool int_val(double value, double tol)
    00047 {
    00048     return fabs( floor( value + 0.5 ) - value ) < tol;
    00049 }
    00050
    00051
    00053 struct Cuts
    00054 {
    00055     Cuts():  numberCuts_(0), cuts_(0)
    00056     {
    00057     }
    00059     int insertAll(OsiCuts & cs, CoinRelFltEq eq);
    00061     ~Cuts() {}
    00063     OsiRowCut * rowCut(unsigned int i)
    00064     {
    00065         return cuts_[i];
    00066     }
    00068     const OsiRowCut * rowCut(unsigned int i) const
    00069     {
    00070         return cuts_[i];
    00071     }
    00073     void insert(int i, OsiRowCut * cut);
    00075     int numberCuts()
    00076     {
    00077         return numberCuts_;
    00078     }
    00080     void resize(unsigned int i)
    00081     {
    00082         cuts_.resize(i, reinterpret_cast<OsiRowCut *> (NULL));
    00083     }
    00084 private:
    00086     int numberCuts_;
    00088     std::vector<OsiRowCut *> cuts_;
    00089 };
    00090
    00091 }
    00092 #endif
    00093