Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
14 #include "CglLandPValidator.hpp"
15 #include "CglCutGenerator.hpp"
16 #include "CglParam.hpp"
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 }
49 class CglLandP : public CglCutGenerator
50 {
51  friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
53  friend class LAP::CglLandPSimplex;
54  friend class CftCglp;
56 public:
59  {
63  };
66  {
71  };
75  {
79  };
83  {
88  };
90  enum LHSnorm
91  {
92  L1 = 0,
93  L2,
98  };
101  {
102  Fixed = 0 ,
104  };
107  class Parameters : public CglParam
108  {
109  public:
111  Parameters();
113  Parameters(const Parameters &other);
115  Parameters & operator=(const Parameters &other);
138  double pivotTol;
140  double away;
142  double timeLimit;
146  double rhsWeight;
162  bool perturb;
174  };
181  ~CglLandP();
183  CglLandP(const CglLandP &source);
185  CglLandP& operator=(const CglLandP &rhs);
187  CglCutGenerator * clone() const;
192  virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
193  const CglTreeInfo info = CglTreeInfo());
197  virtual bool needsOptimalBasis() const
198  {
199  return true;
200  }
203  {
204  return validator_;
205  }
213  void setLogLevel(int level)
214  {
215  handler_->setLogLevel(level);
216  }
218  class NoBasisError : public CoinError
219  {
220  public:
221  NoBasisError(): CoinError("No basis available","LandP","") {}
222  };
225  {
226  public:
227  SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {}
228  };
230  {
231  return params_;
232  }
233 private:
236  void scanExtraCuts(OsiCuts& cs, const double * colsol) const;
241  struct CachedData
242  {
243  CachedData(int nBasics = 0 , int nNonBasics = 0);
244  CachedData(const CachedData & source);
246  CachedData& operator=(const CachedData &source);
248  void getData(const OsiSolverInterface &si);
250  void clean();
252  ~CachedData();
254  int * basics_;
258  int nBasics_;
264  double * colsol_;
266  double * slacks_;
268  bool * integers_;
271  };
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;
291  int numrows_;
293  int numcols_;
299  bool canLift_;
302 };
303 void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
305 #endif
CachedData & operator=(const CachedData &source)
Error Class thrown by an exception.
Definition: CoinError.hpp:42
Definition: CglLandP.hpp:82
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
Generate all violated Mixed integer Gomory cuts in the course of the optimization.
Definition: CglLandP.hpp:70
double rhsWeight
Weight to put in RHS of normalization if static.
Definition: CglLandP.hpp:146
friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string &mpsDir)
virtual ~LapMessages()
Definition: CglLandP.hpp:44
CachedData cached_
Cached informations about problem.
Definition: CglLandP.hpp:283
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate cuts for the model data contained in si.
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
void scanExtraCuts(OsiCuts &cs, const double *colsol) const
CachedData(int nBasics=0, int nNonBasics=0)
Generate no extra cuts.
Definition: CglLandP.hpp:67
Use fractional space only for computing reduced costs.
Definition: CglLandP.hpp:77
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
CoinMessageHandler * handler_
message handler
Definition: CglLandP.hpp:285
Work in full space.
Definition: CglLandP.hpp:78
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
int numrows_
number of rows in the original problems.
Definition: CglLandP.hpp:291
CglLandP & operator=(const CglLandP &rhs)
Assignment operator.
The default COIN simplex (basis-oriented) warm start class.
Normalization normalization
How to weight normalization.
Definition: CglLandP.hpp:164
int nNonBasics_
number of non-basics
Definition: CglLandP.hpp:260
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts.
Definition: CglLandP.hpp:197
LAP::Validator & validator()
Definition: CglLandP.hpp:202
RHS weight in normalization.
Definition: CglLandP.hpp:100
Base class for message handling.
int * basics_
Indices of basic variables in starting basis (ordered if variable basics_[i] s basic in row i) ...
Definition: CglLandP.hpp:254
int nBasics_
number of basics variables
Definition: CglLandP.hpp:258
Select only those rows which had initialy a 0 reduced cost.
Definition: CglLandP.hpp:62
CglLandP(const CglLandP::Parameters &params=CglLandP::Parameters(), const LAP::Validator &validator=LAP::Validator())
Constructor for the class.
Abstract Base Class for describing an interface to a solver.
double * originalColUpper_
Original upper bounds for the problem (for lifting cuts).
Definition: CglLandP.hpp:297
double * originalColLower_
Original lower bounds for the problem (for lifting cuts).
Definition: CglLandP.hpp:295
Some informations that will be changed by the pivots and that we want to keep.
Definition: CglLandP.hpp:241
int pivotLimit
Max number of pivots before we generate the cut 20.
Definition: CglLandP.hpp:121
CoinMessages messages_
Definition: CglLandP.hpp:287
ExtraCutsMode generateExtraCuts
Generate extra constraints from optimal lift-and-project basis.
Definition: CglLandP.hpp:170
void getSortedFractionalIndices(std::vector< int > &indices, const CachedData &data, const CglLandP::Parameters &params) const
Retrieve sorted integer variables which are fractional in the solution.
Cut Generator Base Class.
CoinWarmStartBasis * basis_
Optimal basis.
Definition: CglLandP.hpp:262
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
bool perturb
Apply perturbation procedure.
Definition: CglLandP.hpp:162
select best possible pivot.
Definition: CglLandP.hpp:61
int degeneratePivotLimit
maximum number of consecutive degenerate pivots 0
Definition: CglLandP.hpp:131
double * colsol_
Stores the value of the solution to cut.
Definition: CglLandP.hpp:264
Definition: CglLandP.hpp:58
Definition: CglLandP.hpp:26
2 * current number of constraints.
Definition: CglLandP.hpp:103
LAP::Validator validator_
cut validator
Definition: CglLandP.hpp:289
int getSortedFractionals(CoinPackedVector &xFrac, const CachedData &data, const CglLandP::Parameters &params) const
Retrieve sorted integer variables which are fractional in the solution.
double timeLimit
Total time limit for cut generation.
Definition: CglLandP.hpp:142
void getData(const OsiSolverInterface &si)
Get the data from a problem.
CglCutGenerator * clone() const
Clone function.
int * nonBasics_
Indices of non-basic variables.
Definition: CglLandP.hpp:256
bool strengthen
Do we strengthen the final cut (always do if modularize is 1)
Definition: CglLandP.hpp:156
OsiCuts extraCuts_
Store some extra cut which could be cheaply generated but do not cut current incumbent.
Definition: CglLandP.hpp:301
Parameters params_
Definition: CglLandP.hpp:238
void CglLandPUnitTest(OsiSolverInterface *si, const std::string &mpsDir)
select most negative reduced cost
Definition: CglLandP.hpp:60
double * slacks_
Stores the values of the slacks.
Definition: CglLandP.hpp:266
int maxCutPerRound
Maximum number of cuts generated at a given round.
Definition: CglLandP.hpp:126
Default constructor (with default values)
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
Generate cuts as soon as a structural enters the basis.
Definition: CglLandP.hpp:69
OsiSolverInterface * solver_
Solver before pivots.
Definition: CglLandP.hpp:270
bool canLift_
Flag to say if cuts can be lifted.
Definition: CglLandP.hpp:299
int pivotLimitInTree
Max number of pivots at regular nodes.
Definition: CglLandP.hpp:124
bool * integers_
Stores wheter slacks are integer constrained.
Definition: CglLandP.hpp:268
Sparse Vector.
Generate cuts from the optimal basis.
Definition: CglLandP.hpp:68
Class to validate or reject a cut.
Parameters & operator=(const Parameters &other)
Assignment opertator.
int numcols_
number of columns in the original problems.
Definition: CglLandP.hpp:293
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
Class to hold and manipulate an array of massaged messages.
void setLogLevel(int value)
Set current log (detail) level.
friend class CftCglp
Definition: CglLandP.hpp:54