Cgl  0.59.9
CglLandP.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 // Tepper School of Business
4 // Carnegie Mellon University, Pittsburgh, PA 15213
5 // Date: 07/21/05
6 //
7 // $Id: CglLandP.hpp 1122 2013-04-06 20:39:53Z stefan $
8 //
9 // This code is licensed under the terms of the Eclipse Public License (EPL).
10 //---------------------------------------------------------------------------
11 #ifndef CglLandP_H
12 #define CglLandP_H
13 
14 #include "CglLandPValidator.hpp"
15 #include "CglCutGenerator.hpp"
16 #include "CglParam.hpp"
17 
18 #include <iostream>
19 class CoinWarmStartBasis;
24 namespace LAP
25 {
27 {
36 };
38 class LapMessages : public CoinMessages
39 {
40 public:
42  LapMessages( );
44  virtual ~LapMessages() {}
45 };
46 class CglLandPSimplex;
47 }
48 
49 class CglLandP : public CglCutGenerator
50 {
51  friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
52 
53  friend class LAP::CglLandPSimplex;
54  friend class CftCglp;
55 
56 public:
57 
59  {
60  mostNegativeRc ,
61  bestPivot ,
62  initialReducedCosts
63  };
64 
66  {
67  none,
68  AtOptimalBasis ,
69  WhenEnteringBasis ,
70  AllViolatedMigs
71  };
72 
75  {
76  Fractional=0 ,
77  Fractional_rc,
78  Full
79  };
80 
83  {
84  Unweighted = 0,
87  WeightBoth
88  };
89 
90  enum LHSnorm
91  {
92  L1 = 0,
93  L2,
97  Uniform
98  };
101  {
102  Fixed = 0 ,
103  Dynamic
104  };
107  class Parameters : public CglParam
108  {
109  public:
111  Parameters();
113  Parameters(const Parameters &other);
115  Parameters & operator=(const Parameters &other);
118 
137 
138  double pivotTol;
140  double away;
142  double timeLimit;
146  double rhsWeight;
148 
151 
162  bool perturb;
174  };
175 
176 
179  const LAP::Validator &validator = LAP::Validator());
181  ~CglLandP();
183  CglLandP(const CglLandP &source);
185  CglLandP& operator=(const CglLandP &rhs);
187  CglCutGenerator * clone() const;
188 
191 
192  virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
193  const CglTreeInfo info = CglTreeInfo());
194 
196 
197  virtual bool needsOptimalBasis() const
198  {
199  return true;
200  }
201 
203  {
204  return validator_;
205  }
213  void setLogLevel(int level)
214  {
215  handler_->setLogLevel(level);
216  }
217 
218  class NoBasisError : public CoinError
219  {
220  public:
221  NoBasisError(): CoinError("No basis available","LandP","") {}
222  };
223 
224  class SimplexInterfaceError : public CoinError
225  {
226  public:
227  SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {}
228  };
230  {
231  return params_;
232  }
233 private:
234 
235 
236  void scanExtraCuts(OsiCuts& cs, const double * colsol) const;
237 
238  Parameters params_;
239 
241  struct CachedData
242  {
243  CachedData(int nBasics = 0 , int nNonBasics = 0);
244  CachedData(const CachedData & source);
245 
246  CachedData& operator=(const CachedData &source);
248  void getData(const OsiSolverInterface &si);
249 
250  void clean();
251 
252  ~CachedData();
254  int * basics_;
256  int *nonBasics_;
258  int nBasics_;
260  int nNonBasics_;
262  CoinWarmStartBasis * basis_;
264  double * colsol_;
266  double * slacks_;
268  bool * integers_;
270  OsiSolverInterface * solver_;
271  };
274  int getSortedFractionals(CoinPackedVector &xFrac,
275  const CachedData & data,
276  const CglLandP::Parameters& params) const;
279  void getSortedFractionalIndices(std::vector<int>& indices,
280  const CachedData &data,
281  const CglLandP::Parameters & params) const;
283  CachedData cached_;
285  CoinMessageHandler * handler_;
287  CoinMessages messages_;
289  LAP::Validator validator_;
291  int numrows_;
293  int numcols_;
295  double * originalColLower_;
297  double * originalColUpper_;
299  bool canLift_;
301  OsiCuts extraCuts_;
302 };
303 void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
304 
305 #endif
306 
Normalization
Normalization.
Definition: CglLandP.hpp:82
SeparationSpaces
Space where cuts are optimized.
Definition: CglLandP.hpp:74
void setLogLevel(int level)
set level of log for cut generation procedure :
Definition: CglLandP.hpp:213
double rhsWeight
Weight to put in RHS of normalization if static.
Definition: CglLandP.hpp:146
virtual ~LapMessages()
destructor.
Definition: CglLandP.hpp:44
double singleCutTimeLimit
Time limit for generating a single cut.
Definition: CglLandP.hpp:144
Class storing parameters.
Definition: CglLandP.hpp:107
int failedPivotLimit
Maximum number of failed pivots before aborting.
Definition: CglLandP.hpp:128
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
SelectionRules pivotSelection
Which rule to apply for choosing entering and leaving variables.
Definition: CglLandP.hpp:172
Normalization normalization
How to weight normalization.
Definition: CglLandP.hpp:164
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts.
Definition: CglLandP.hpp:197
LAP::Validator & validator()
Definition: CglLandP.hpp:202
RhsWeightType
RHS weight in normalization.
Definition: CglLandP.hpp:100
int pivotLimit
Max number of pivots before we generate the cut 20.
Definition: CglLandP.hpp:121
ExtraCutsMode generateExtraCuts
Generate extra constraints from optimal lift-and-project basis.
Definition: CglLandP.hpp:170
Cut Generator Base Class.
Parameters & parameter()
Definition: CglLandP.hpp:229
LHSnorm lhs_norm
How to weight LHS of normalization.
Definition: CglLandP.hpp:168
bool useTableauRow
Do we use tableau row or the disjunction (I don&#39;t really get that there should be a way to always use...
Definition: CglLandP.hpp:152
Class collecting parameters for all cut generators.
Definition: CglParam.hpp:22
Output messages for Cgl.
Definition: CglLandP.hpp:38
LapMessages()
Constructor.
bool perturb
Apply perturbation procedure.
Definition: CglLandP.hpp:162
int degeneratePivotLimit
maximum number of consecutive degenerate pivots 0
Definition: CglLandP.hpp:131
SelectionRules
Definition: CglLandP.hpp:58
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition: CglLandP.hpp:24
LapMessagesTypes
Definition: CglLandP.hpp:26
double timeLimit
Total time limit for cut generation.
Definition: CglLandP.hpp:142
bool strengthen
Do we strengthen the final cut (always do if modularize is 1)
Definition: CglLandP.hpp:156
void CglLandPUnitTest(OsiSolverInterface *si, const std::string &mpsDir)
int maxCutPerRound
Maximum number of cuts generated at a given round.
Definition: CglLandP.hpp:126
RhsWeightType rhsWeightType
How to weight RHS of normalization.
Definition: CglLandP.hpp:166
double pivotTol
Tolerance for small pivots values (should be the same as the solver.
Definition: CglLandP.hpp:138
bool countMistakenRc
Wether to limit or not the number of mistaken RC (when perturbation is applied).
Definition: CglLandP.hpp:158
double away
A variable have to be at least away from integrity to be generated.
Definition: CglLandP.hpp:140
bool modularize
Do we apply Egon Balas&#39;s Heuristic for modularized cuts.
Definition: CglLandP.hpp:154
int pivotLimitInTree
Max number of pivots at regular nodes.
Definition: CglLandP.hpp:124
Class to validate or reject a cut.
int extraCutsLimit
Maximum number of extra rows to generate per round.
Definition: CglLandP.hpp:133
SeparationSpaces sepSpace
Work in the reduced space (only non-structurals enter the basis)
Definition: CglLandP.hpp:160