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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Cgl/src/CglRedSplit/CglRedSplit.hpp

Go to the documentation of this file.

    00001 // Last edit: 4/20/07
    00002 //
    00003 // Name:     CglRedSplit.hpp
    00004 // Author:   Francois Margot
    00005 //           Tepper School of Business
    00006 //           Carnegie Mellon University, Pittsburgh, PA 15213
    00007 //           email: fmargot@andrew.cmu.edu
    00008 // Date:     2/6/05
    00009 //
    00010 // $Id: CglRedSplit.hpp 1119 2013-04-06 20:24:18Z stefan $
    00011 //-----------------------------------------------------------------------------
    00012 // Copyright (C) 2005, Francois Margot and others.  All Rights Reserved.
    00013 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00014
    00015 #ifndef CglRedSplit_H
    00016 #define CglRedSplit_H
    00017
    00018 #include "CglCutGenerator.hpp"
    00019 #include "CglRedSplitParam.hpp"
    00020
    00026 class CglRedSplit : public CglCutGenerator {
    00027
    00028   friend void CglRedSplitUnitTest(const OsiSolverInterface * siP,
    00029                                   const std::string mpdDir);
    00030 public:
    00061   virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
    00062                             const CglTreeInfo info = CglTreeInfo());
    00063
    00065   virtual bool needsOptimalBasis() const;
    00067
    00068
    00071
    00072   // Set the parameters to the values of the given CglRedSplitParam object.
    00073   void setParam(const CglRedSplitParam &source);
    00074   // Return the CglRedSplitParam object of the generator.
    00075   inline CglRedSplitParam getParam() const {return param;}
    00076
    00077   // Compute entries of low_is_lub and up_is_lub.
    00078   void compute_is_lub();
    00079
    00080   // Compute entries of is_integer.
    00081   void compute_is_integer();
    00082
    00088   void set_given_optsol(const double *given_sol, const int card_sol);
    00089
    00091   void print() const;
    00092
    00094   void printOptTab(OsiSolverInterface *solver) const;
    00095
    00097
    00100   //************************************************************
    00101   // TO BE REMOVED
    00104   void setLimit(int limit);
    00106   int getLimit() const;
    00107
    00112   void setAway(double value);
    00114   double getAway() const;
    00118   void setLUB(double value);
    00120   double getLUB() const;
    00121
    00124   void setEPS(double value);
    00126   double getEPS() const;
    00127
    00130   void setEPS_COEFF(double value);
    00132   double getEPS_COEFF() const;
    00133
    00137   void setEPS_COEFF_LUB(double value);
    00139   double getEPS_COEFF_LUB() const;
    00140
    00144   void setEPS_RELAX(double value);
    00146   double getEPS_RELAX() const;
    00147
    00150   void setNormIsZero(double value);
    00152   double getNormIsZero() const;
    00153
    00156   void setMinReduc(double value);
    00158   double getMinReduc() const;
    00159
    00165   void setMaxTab(double value);
    00167   double getMaxTab() const;
    00168   // END TO BE REMOVED
    00169   //************************************************************
    00170
    00172
    00175
    00176   CglRedSplit();
    00177
    00179   CglRedSplit(const CglRedSplitParam &RS_param);
    00180
    00182   CglRedSplit (const CglRedSplit &);
    00183
    00185   virtual CglCutGenerator * clone() const;
    00186
    00188   CglRedSplit &
    00189     operator=(
    00190     const CglRedSplit& rhs);
    00191
    00193   virtual
    00194     ~CglRedSplit ();
    00196   virtual std::string generateCpp( FILE * fp);
    00198
    00199 private:
    00200
    00201   // Private member methods
    00202
    00206
    00207   // Method generating the cuts after all CglRedSplit members are properly set.
    00208   void generateCuts(OsiCuts & cs);
    00209
    00211   inline double rs_above_integer(double value);
    00212
    00214   void update_pi_mat(int r1, int r2, int step);
    00215
    00217   void update_redTab(int r1, int r2, int step);
    00218
    00221   void find_step(int r1, int r2, int *step,
    00222                  double *reduc, double *norm);
    00223
    00226   int test_pair(int r1, int r2, double *norm);
    00227
    00229   void reduce_contNonBasicTab();
    00230
    00232   void generate_row(int index_row, double *row);
    00233
    00236   int generate_cgcut(double *row, double *rhs);
    00237
    00240   int generate_cgcut_2(int basic_ind, double *row, double *rhs);
    00241
    00244   void eliminate_slacks(double *row,
    00245                         const double *elements,
    00246                         const int *start,
    00247                         const int *indices,
    00248                         const int *rowLength,
    00249                         const double *rhs, double *rowrhs);
    00250
    00253   void flip(double *row);
    00254
    00259   void unflip(double *row, double *rowrhs, double *slack_val);
    00260
    00268   double row_scale_factor(double *row);
    00269
    00271   int generate_packed_row(const double *xlp, double *row,
    00272                           int *rowind, double *rowelem,
    00273                           int *card_row, double & rhs);
    00274
    00276   void check_optsol(const int calling_place,
    00277                     const double *xlp, const double *slack_val,
    00278                     const int do_flip);
    00279
    00281   void check_optsol(const int calling_place,
    00282                     const double *xlp, const double *slack_val,
    00283                     const double *ck_row, const double ck_rhs,
    00284                     const int cut_number, const int do_flip);
    00285
    00286   // Check that two vectors are different.
    00287   bool rs_are_different_vectors(const int *vect1,
    00288                                 const int *vect2,
    00289                                 const int dim);
    00290
    00291   // Check that two vectors are different.
    00292   bool rs_are_different_vectors(const double *vect1,
    00293                                 const double *vect2,
    00294                                 const int dim);
    00295
    00296   // Check that two matrices are different.
    00297   bool rs_are_different_matrices(const CoinPackedMatrix *mat1,
    00298                                  const CoinPackedMatrix *mat2,
    00299                                  const int nmaj,
    00300                                  const int nmin);
    00302
    00303
    00304   // Private member data
    00305
    00309
    00311   CglRedSplitParam param;
    00312
    00314   int nrow;
    00315
    00317   int ncol;
    00318
    00320   const double *colLower;
    00321
    00323   const double *colUpper;
    00324
    00326   const double *rowLower;
    00327
    00329   const double *rowUpper;
    00330
    00332   const double *rowRhs;
    00333
    00336   int card_intBasicVar_frac;
    00337
    00340   int card_intNonBasicVar;
    00341
    00344   int card_contNonBasicVar;
    00345
    00348   int card_nonBasicAtUpper;
    00349
    00352   int card_nonBasicAtLower;
    00353
    00356   int *cv_intBasicVar_frac;
    00357
    00360   int *intBasicVar_frac;
    00361
    00363   int *intNonBasicVar;
    00364
    00366   // slacks are considered continuous (no harm if this is not the case).
    00367   int *contNonBasicVar;
    00368
    00371   int *nonBasicAtUpper;
    00372
    00375   int *nonBasicAtLower;
    00376
    00378   int mTab;
    00379
    00381   int nTab;
    00382
    00385   int **pi_mat;
    00386
    00390   double **contNonBasicTab;
    00391
    00394   // Dimensions: mTab by card_intNonBasicVar.
    00395   double **intNonBasicTab;
    00396
    00399   double *rhsTab ;
    00400
    00402   const double *given_optsol;
    00403
    00405   int card_given_optsol;
    00406
    00409   int *is_integer;
    00410
    00413   int *low_is_lub;
    00414
    00417   int *up_is_lub;
    00418
    00420   OsiSolverInterface *solver;
    00421
    00423   const double *xlp;
    00424
    00426   const double *rowActivity;
    00427
    00429   const char *colType;
    00430
    00433   const CoinPackedMatrix *byRow;
    00434
    00436 };
    00437
    00438 //#############################################################################
    00444 void CglRedSplitUnitTest(const OsiSolverInterface * siP,
    00445                          const std::string mpdDir );
    00446
    00447
    00448 #endif