Dip  0.92.4
CbcGenCtlBlk.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007, Lou Hafer, International Business Machines Corporation
3  and others. All Rights Reserved.
4 
5  This code is licensed under the terms of the Eclipse Public License (EPL).
6 
7  $Id: CbcGenCtlBlk.hpp 2467 2019-01-03 21:26:29Z unxusr $
8 */
9 /*
10  This file is part of cbc-generic.
11 */
12 
13 #ifndef CbcGenCtlBlk_H
14 #define CbcGenCtlBlk_H
15 
16 /* \file CbcGenCtlBlk.hpp
17  \brief Declarations for parameters of the cbc-generic main program.
18 */
19 
20 #include "CoinParam.hpp"
21 #include "CoinMessageHandler.hpp"
22 
23 #include "CglCutGenerator.hpp"
24 #include "CglProbing.hpp"
25 #include "CglClique.hpp"
26 #include "CglFlowCover.hpp"
27 #include "CglGomory.hpp"
28 #include "CglKnapsackCover.hpp"
30 #include "CglOddHole.hpp"
31 #include "CglRedSplit.hpp"
32 #include "CglTwomir.hpp"
33 
34 #include "CbcModel.hpp"
35 
36 #include "CbcHeuristic.hpp"
37 #include "CbcHeuristicFPump.hpp"
38 #include "CbcHeuristicGreedy.hpp"
39 #include "CbcHeuristicLocal.hpp"
40 #include "CbcTreeLocal.hpp"
41 
42 #include "CbcGenMessages.hpp"
43 
44 /*
45  It turns out that doxygen is not good with anonymous structures. Hence the
46  `struct nameCtl_struct' style used for structured fields in CbcGenCtlBlk.
47 */
48 
49 /*
50  $Id: CbcGenCtlBlk.hpp 2467 2019-01-03 21:26:29Z unxusr $
51 */
52 
53 #define CBC_GENERIC_VERSION "00.01.00"
54 
55 class CbcGenCtlBlk;
56 namespace CbcGenParamUtils {
57 void addCbcGenParams(int &numParams, CoinParamVec &paramVec,
58  CbcGenCtlBlk *ctlBlk);
59 }
60 
61 /* \brief cbc-generic algorithm control class
62 
63  This class defines values and methods used to control the operation of the
64  cbc-generic main program.
65 */
66 
67 class CbcGenCtlBlk {
68 
69  friend void CbcGenParamUtils::addCbcGenParams(int &numParams,
70  CoinParamVec &paramVec, CbcGenCtlBlk *ctlBlk);
71 
72 public:
75 
76  /*
77  In order for initialisation to work properly, the order of declaration of
78  the enum constants here must match the order of keyword declaration for
79  the PREPROCESS parameter in CbcGenParamUtils::addCbcGenParams
80  */
98  typedef enum { IPPOff = 0,
106  } IPPControl;
107 
108  /*
109  In order for initialisation to work properly, the order of declaration of
110  the enum constants here must match the order of keyword declaration for
111  the various cut and heuristic control parameters in
112  CbcGenParamUtils::addCbcGenParams
113  */
134  typedef enum { CGOff,
141  } CGControl;
142 
151  typedef enum { BPOff,
155 
171  typedef enum { BACInvalid = -1,
173  BACStop = 1,
177  } BACMajor;
178 
198  typedef enum { BACmInvalid = -1,
208  } BACMinor;
209 
219  typedef enum { BACwInvalid = -1,
225  } BACWhere;
226 
228 
231 
234  CbcGenCtlBlk();
235 
238  ~CbcGenCtlBlk();
240 
256 
264  inline int getCutDepth()
265  {
266  return cutDepth_;
267  }
268 
274  inline void setCutDepth(int cutDepth)
275  {
276  cutDepth_ = cutDepth;
277  }
278 
279  /*1 \brief Get action state for use of integer preprocessing */
280 
282  {
283  return (preProcess_);
284  }
285 
288  inline void setIPPAction(IPPControl action)
289  {
290  preProcess_ = action;
291  }
292 
296 
299  inline void setProbingAction(CGControl action)
300  {
301  probing_.action_ = action;
302  }
303 
307 
310  inline void setCliqueAction(CGControl action)
311  {
312  clique_.action_ = action;
313  }
314 
318 
321  inline void setFlowAction(CGControl action)
322  {
323  flow_.action_ = action;
324  }
325 
329 
332  inline void setGomoryAction(CGControl action)
333  {
334  gomory_.action_ = action;
335  }
336 
340 
343  inline void setKnapsackAction(CGControl action)
344  {
345  knapsack_.action_ = action;
346  }
347 
348  /* \brief Obtain a prototype for a lift-and-project cut generator.
349 
350  CGControl getLandP(CglCutGenerator *&gen) ;
351 
352  \brief Set action state for use of lift-and-project cut generator.
353 
354  inline void setLandPAction(CGControl action)
355  { landp_.action_ = action ; }
356  */
357 
363 
366  inline void setMirAction(CGControl action)
367  {
368  mir_.action_ = action;
369  }
370 
374 
377  inline void setRedSplitAction(CGControl action)
378  {
379  redSplit_.action_ = action;
380  }
381 
385 
388  inline void setTwomirAction(CGControl action)
389  {
390  twomir_.action_ = action;
391  }
392 
400  CGControl getFPump(CbcHeuristic *&gen, CbcModel *model,
401  bool alwaysCreate = true);
402 
405  inline void setFPumpAction(CGControl action)
406  {
407  fpump_.action_ = action;
408  }
409 
418  bool alwaysCreate = true);
419 
422  inline void setCombineAction(CGControl action)
423  {
424  combine_.action_ = action;
425  }
426 
435  bool alwaysCreate = true);
436 
439  inline void setGreedyCoverAction(CGControl action)
440  {
441  greedyCover_.action_ = action;
442  }
443 
452  bool alwaysCreate = true);
453 
456  inline void setGreedyEqualityAction(CGControl action)
457  {
458  greedyEquality_.action_ = action;
459  }
460 
469  bool alwaysCreate = true);
470 
473  inline void setRoundingAction(CGControl action)
474  {
475  rounding_.action_ = action;
476  }
477 
485  CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model,
486  bool alwaysCreate = true);
487 
490  inline void setTreeLocalAction(CGControl action)
491  {
492  localTree_.action_ = action;
493  }
494 
496 
501 
504  inline void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus,
505  BACWhere where, bool haveAnswer,
506  OsiSolverInterface *answerSolver)
507  {
508  bab_.majorStatus_ = majorStatus;
509  bab_.minorStatus_ = minorStatus;
510  bab_.where_ = where;
511  bab_.haveAnswer_ = haveAnswer;
512  bab_.answerSolver_ = answerSolver;
513  }
514 
520  void setBaBStatus(const CbcModel *model, BACWhere where,
521  bool haveAnswer = false,
522  OsiSolverInterface *answerSolver = 0);
523 
528  BACMajor translateMajor(int status);
529 
534  BACMinor translateMinor(int status);
535 
542 
545  void printBaBStatus();
546 
548 
551 
557 
564 
567  {
568  return msgHandler_;
569  }
570 
584 
586  inline void setLogLevel(int lvl)
587  {
588  logLvl_ = lvl;
589  if (msgHandler_)
590  msgHandler_->setLogLevel(lvl);
591  }
592 
594  inline int logLevel() const
595  {
596  return (logLvl_);
597  }
598 
603 
605 
610  std::string version_;
611 
614  std::string dfltDirectory_;
615 
618  std::string lastMpsIn_;
619 
622 
625  std::string lastSolnOut_;
626 
634 
640  std::string printMask_;
641 
644  CoinParamVec *paramVec_;
645 
649  int first_;
650  int last_;
651  } genParams_;
652 
656  int first_;
657  int last_;
658  } cbcParams_;
659 
665  int first_;
666  int last_;
667  } osiParams_;
668 
678  int verbose_;
679 
683 
686  std::vector< bool > setByUser_;
687 
695 
704  std::string debugCreate_;
705 
712  std::string debugFile_;
713 
720  int numCols_;
721  double *values_;
722  } debugSol_;
724 
725  /* \name Timing */
727 
730  double totalTime_;
731 
733 
736 
748 
756 
760 
774  } bab_;
775 
777 
780 
790  bool action_;
791  double threshold_;
792  } djFix_;
793 
798 
800 
807 
819  } chooseStrong_;
821 
822 private:
827 
831 
839 
845  int maxPass_;
849  int maxLook_;
852  int rowCuts_;
853  } probing_;
854 
862  } clique_;
863 
865  struct flowCtl_struct {
868  } flow_;
869 
874  int limit_;
876  } gomory_;
877 
878  /* \brief Control variable and prototype for lift-and-project cut
879  generator
880  struct landpCtl_struct
881  { CGControl action_ ;
882  CglLandP *proto_ ; } landp_ ;
883  */
884 
889  } knapsack_;
890 
892  struct mirCtl_struct {
895  } mir_;
896 
901  } oddHole_;
902 
909  } redSplit_;
910 
916  } twomir_;
917 
922  int iters_;
923  } fpump_;
924 
929  int trySwap_;
930  } combine_;
931 
936  } greedyCover_;
937 
942  } greedyEquality_;
943 
948  } rounding_;
949 
959  double *soln_;
960  int range_;
965  bool refine_;
966  } localTree_;
967 
969 
975 
978 
986 
989 
992 
994  int logLvl_;
995 
997 };
998 
999 #endif
1000 
1001 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
1002 */
CbcHeuristicFPump * proto_
struct CbcGenCtlBlk::chooseStrongCtl_struct chooseStrong_
std::string lastSolnOut_
Last solution output file.
struct CbcGenCtlBlk::babState_struct bab_
The reference CbcModel object.
CGControl getGreedyEquality(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a greedy equality heuristic.
struct CbcGenCtlBlk::greedyCoverCtl_struct greedyCover_
Control integer preprocessing.
CGControl getClique(CglCutGenerator *&gen)
Obtain a prototype for a clique cut generator.
struct CbcGenCtlBlk::osiParamsInfo_struct osiParams_
cbc-generic version
struct CbcGenCtlBlk::combineCtl_struct combine_
Control integer preprocessing.
Base class for message handling.
CGControl getFlow(CglCutGenerator *&gen)
Obtain a prototype for a flow cover cut generator.
Control variable and prototype for feasibility pump heuristic.
LocalSearch class.
void setLogLevel(int lvl)
Set log level.
int paramsProcessed_
Number of parameters processed.
void printBaBStatus()
Print the status block.
std::string debugCreate_
Control debug file creation.
std::string version_
cbc-generic version
CoinMessageHandler & message(CbcGenMsgCode inID)
Print a message.
CoinMessageHandler * msgHandler_
Message handler.
Control variable and prototype for flow cover cut generator.
struct CbcGenCtlBlk::knapsackCtl_struct knapsack_
Control integer preprocessing.
IPPControl getIPPAction()
Get cut depth setting.
Rounding class.
void setMirAction(CGControl action)
Set action state for use of MIR cut generator.
CGControl getTwomir(CglCutGenerator *&gen)
Obtain a prototype for a 2-MIR cut generator.
bool ourMsgHandler_
Ownership of message handler.
BACMajor translateMajor(int status)
Translate CbcModel major status to BACMajor.
void setProbingAction(CGControl action)
Set action state for use of probing cut generator.
BACMinor
Minor status codes.
OsiSolverInterface * dfltSolver_
The current default LP solver.
CGControl getKnapsack(CglCutGenerator *&gen)
Obtain a prototype for a knapsack cover cut generator.
Control variables for local tree.
Odd Hole Cut Generator Class.
Definition: CglOddHole.hpp:14
IPPControl
Codes to control integer preprocessing.
int logLvl_
The current log level.
Start and end of cbc-generic parameters in parameter vector.
Control variable and prototype for simple rounding heuristic.
IPPControl preProcess_
Control integer preprocessing.
Control variable and prototype for probing cut generator.
Control variable and prototype for Gomory cut generator.
Control variable and prototype for clique cut generator.
void setFPumpAction(CGControl action)
Set action state for use of feasibility pump heuristic.
CoinParamVec * paramVec_
The parameter vector.
std::string lastMpsIn_
Last MPS input file.
Feasibility Pump class.
struct CbcGenCtlBlk::probingCtl_struct probing_
Control integer preprocessing.
void setRedSplitAction(CGControl action)
Set action state for use of reduce and split cut generator.
CbcHeuristicGreedyCover * proto_
Control variable and prototype for reduce-and-split cut generator.
void setGreedyEqualityAction(CGControl action)
Set action state for use of greedy equality heuristic.
Lifed Simple Generalized Flow Cover Cut Generator Class.
void setTreeLocalAction(CGControl action)
Set action state for use of local tree.
struct CbcGenCtlBlk::redSplitCtl_struct redSplit_
Control integer preprocessing.
Control use of reduced cost fixing prior to B&amp;C.
void addCbcGenParams(int &numParams, CoinParamVec &paramVec, CbcGenCtlBlk *ctlBlk)
CGControl getCombine(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a local search/combine heuristic.
int cutDepth_
Control cut generator activity.
void setRoundingAction(CGControl action)
Set action state for use of simple rounding heuristic.
Array of primal variable values for debugging.
struct CbcGenCtlBlk::localTreeCtl_struct localTree_
Control integer preprocessing.
BPControl priorityAction_
Control the assignment of branching priorities to integer variables.
CoinMessageHandler * messageHandler() const
Return a pointer to the message handler.
void setTwomirAction(CGControl action)
Set action state for use of 2-MIR cut generator.
CGControl getRounding(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a simple rounding heuristic.
CbcModel * model_
The reference CbcModel object.
void passInMessageHandler(CoinMessageHandler *handler)
Supply a new message handler.
void setCliqueAction(CGControl action)
Set action state for use of clique cut generator.
Probing Cut Generator Class.
Definition: CglProbing.hpp:25
struct CbcGenCtlBlk::debugSolInfo_struct debugSol_
cbc-generic version
CGControl getGreedyCover(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a greedy cover heuristic.
void setGreedyCoverAction(CGControl action)
Set action state for use of greedy cover heuristic.
int printOpt_
When greater than 0, integer presolve gives more information and branch-and-cut provides statistics...
Gomory Reduce-and-Split Cut Generator Class; See method generateCuts().
Definition: CglRedSplit.hpp:26
int verbose_
Verbosity level for help messages.
Start and end of OsiSolverInterface parameters in parameter vector.
CglMixedIntegerRounding2 * proto_
Declaration of a class for command line parameters.
struct CbcGenCtlBlk::greedyEqualityCtl_struct greedyEquality_
Control integer preprocessing.
Control variable and prototype for greedy equality heuristic.
Gomory Cut Generator Class.
Definition: CglGomory.hpp:14
void setIPPAction(IPPControl action)
Set action state for use of integer preprocessing.
CGControl getFPump(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a feasibility pump heuristic.
struct CbcGenCtlBlk::djFixCtl_struct djFix_
Control the assignment of branching priorities to integer variables.
struct CbcGenCtlBlk::cliqueCtl_struct clique_
Control integer preprocessing.
This is a first attempt at a message handler.
Greedy heuristic classes.
std::vector< bool > setByUser_
Record of parameters changed by user command.
Abstract Base Class for describing an interface to a solver.
struct CbcGenCtlBlk::gomoryCtl_struct gomory_
Control integer preprocessing.
struct CbcGenCtlBlk::roundingCtl_struct rounding_
Control integer preprocessing.
Cut Generator Base Class.
int logLevel() const
Get log level.
CGControl getGomory(CglCutGenerator *&gen)
Obtain a prototype for a Gomory cut generator.
std::string printMask_
Print mask.
CbcGenMsgCode
Symbolic names for cbc-generic messages.
Knapsack Cover Cut Generator Class.
Control variable and prototype for Two-MIR cut generator.
void setFlowAction(CGControl action)
Set action state for use of flow cover cut generator.
struct CbcGenCtlBlk::fpumpCtl_struct fpump_
Control integer preprocessing.
bool defaultSettings_
False if the user has made nontrivial modifications to the default control settings.
Class to hold and manipulate an array of massaged messages.
void setKnapsackAction(CGControl action)
Set action state for use of knapsack cut generator.
OsiSolverInterface * answerSolver_
struct CbcGenCtlBlk::mirCtl_struct mir_
Control integer preprocessing.
struct CbcGenCtlBlk::oddHoleCtl_struct oddHole_
Control integer preprocessing.
void setMessages(CoinMessages::Language lang=CoinMessages::us_en)
Set up messages in the specified language.
void setGomoryAction(CGControl action)
Set action state for use of Gomory cut generator.
BACMinor translateMinor(int status)
Translate CbcModel minor status to BACMinor.
Heuristic base class.
CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model, bool alwaysCreate=true)
Obtain a local search tree object.
CGControl
Codes to control the use of cut generators and heuristics.
double totalTime_
Total elapsed time for this run.
std::string dfltDirectory_
Default directory prefix.
struct CbcGenCtlBlk::twomirCtl_struct twomir_
Control integer preprocessing.
Start and end of CbcModel parameters in parameter vector.
void setLogLevel(int value)
Set current log (detail) level.
BACWhere
Codes to specify where branch-and-cut stopped.
CbcGenCtlBlk()
Default constructor.
BACMajor
Major status codes for branch-and-cut.
std::string debugFile_
Last debug input file.
struct CbcGenCtlBlk::flowCtl_struct flow_
Control integer preprocessing.
Control variable and prototype for knapsack cover cut generator.
~CbcGenCtlBlk()
Destructor.
Control variables for a strong branching method.
int printMode_
Solution printing mode.
Control variable and prototype for MIR cut generator.
CoinMessages * msgs_
The current set of messages.
Mixed Integer Rounding Cut Generator Class.
void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus, BACWhere where, bool haveAnswer, OsiSolverInterface *answerSolver)
Set the result of branch-and-cut search.
State of branch-and-cut.
Control variable and prototype for odd hole cut generator.
bool allowImportErrors_
Allow/disallow errors when importing a model.
int getCutDepth()
Get cut depth setting.
struct CbcGenCtlBlk::genParamsInfo_struct genParams_
cbc-generic version
Language
Supported languages.
CoinMessages::Language cur_lang_
The current language.
CbcHeuristicGreedyEquality * proto_
struct CbcGenCtlBlk::cbcParamsInfo_struct cbcParams_
cbc-generic version
Control variable and prototype for greedy cover heuristic.
BPControl
Codes to specify the assignment of branching priorities.
bool goodModel_
True if we have a valid model loaded, false otherwise.
Control variable and prototype for combine heuristic.
CGControl getProbing(CglCutGenerator *&gen)
Obtain a prototype for a probing cut generator.
CGControl getRedSplit(CglCutGenerator *&gen)
Obtain a prototype for a reduce and split cut generator.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
void setCutDepth(int cutDepth)
Set cut depth setting.
Twostep MIR Cut Generator Class.
Definition: CglTwomir.hpp:91
CGControl getMir(CglCutGenerator *&gen)
Obtain a prototype for a mixed integer rounding (MIR) cut generator.
void setCombineAction(CGControl action)
Set action state for use of local search/combine heuristic.