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

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.6/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 // $Id$
    00008 //
    00009 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00010 //---------------------------------------------------------------------------
    00011
    00012 #ifndef CglLandPUtils_H
    00013 #define CglLandPUtils_H
    00014 #include "CglLandPTabRow.hpp"
    00015
    00016 class CoinRelFltEq;
    00017 class OsiRowCut;
    00018 class OsiCuts;
    00019 #include <vector>
    00020 #include <cmath>
    00021
    00022 namespace LAP
    00023 {
    00025 double normCoef(TabRow &row, int ncols, const int * nonBasics);
    00027 void scale(OsiRowCut &cut);
    00029 void scale(OsiRowCut &cut, double norma);
    00031 void modularizeRow(TabRow & row, const bool * integerVar);
    00032
    00033
    00035 inline double intersectionCutCoef(double alpha_i, double beta)
    00036 {
    00037     if (alpha_i>0) return alpha_i* (1 - beta);
    00038     else return -alpha_i * beta;// (1 - beta);
    00039 }
    00040
    00042 inline double modularizedCoef(double alpha, double beta)
    00043 {
    00044     double f_i = alpha - floor(alpha);
    00045     if (f_i <= beta)
    00046         return f_i;
    00047     else
    00048         return f_i - 1;
    00049 }
    00050
    00052 inline bool int_val(double value, double tol)
    00053 {
    00054     return fabs( floor( value + 0.5 ) - value ) < tol;
    00055 }
    00056
    00057
    00059 struct Cuts
    00060 {
    00061     Cuts():  numberCuts_(0), cuts_(0)
    00062     {
    00063     }
    00065     int insertAll(OsiCuts & cs, CoinRelFltEq& eq);
    00067     ~Cuts() {}
    00069     OsiRowCut * rowCut(unsigned int i)
    00070     {
    00071         return cuts_[i];
    00072     }
    00074     const OsiRowCut * rowCut(unsigned int i) const
    00075     {
    00076         return cuts_[i];
    00077     }
    00079     void insert(int i, OsiRowCut * cut);
    00081     int numberCuts()
    00082     {
    00083         return numberCuts_;
    00084     }
    00086     void resize(unsigned int i)
    00087     {
    00088         cuts_.resize(i, reinterpret_cast<OsiRowCut *> (NULL));
    00089     }
    00090 private:
    00092     int numberCuts_;
    00094     std::vector<OsiRowCut *> cuts_;
    00095 };
    00096
    00097 }
    00098 #endif
    00099