Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 */
int logLevel() const
Get log level.
void setProbingAction(CGControl action)
Set action state for use of probing cut generator.
LocalSearch class.
struct CbcGenCtlBlk::oddHoleCtl_struct oddHole_
struct CbcGenCtlBlk::debugSolInfo_struct debugSol_
struct CbcGenCtlBlk::djFixCtl_struct djFix_
Start and end of CbcModel parameters in parameter vector.
struct CbcGenCtlBlk::gomoryCtl_struct gomory_
struct CbcGenCtlBlk::localTreeCtl_struct localTree_
BACMinor translateMinor(int status)
Translate CbcModel minor status to BACMinor.
void setGomoryAction(CGControl action)
Set action state for use of Gomory cut generator.
Control variable and prototype for Two-MIR cut generator.
struct CbcGenCtlBlk::greedyEqualityCtl_struct greedyEquality_
Declaration of a class for command line parameters.
bool ourMsgHandler_
Ownership of message handler.
Control variable and prototype for MIR cut generator.
std::string lastSolnOut_
Last solution output file.
IPPControl preProcess_
Control integer preprocessing.
struct CbcGenCtlBlk::flowCtl_struct flow_
Control variable and prototype for odd hole cut generator.
struct CbcGenCtlBlk::probingCtl_struct probing_
~CbcGenCtlBlk()
Destructor.
IPPControl getIPPAction()
int printMode_
Solution printing mode.
struct CbcGenCtlBlk::knapsackCtl_struct knapsack_
CGControl
Codes to control the use of cut generators and heuristics.
Control variable and prototype for probing cut generator.
CoinMessages * msgs_
The current set of messages.
struct CbcGenCtlBlk::osiParamsInfo_struct osiParams_
std::string debugCreate_
Control debug file creation.
BACWhere
Codes to specify where branch-and-cut stopped.
struct CbcGenCtlBlk::roundingCtl_struct rounding_
void setCombineAction(CGControl action)
Set action state for use of local search/combine heuristic.
Control variable and prototype for combine heuristic.
CoinMessageHandler & message(CbcGenMsgCode inID)
Print a message.
CGControl getTwomir(CglCutGenerator *&gen)
Obtain a prototype for a 2-MIR cut generator.
void setRedSplitAction(CGControl action)
Set action state for use of reduce and split cut generator.
void setFPumpAction(CGControl action)
Set action state for use of feasibility pump heuristic.
void setRoundingAction(CGControl action)
Set action state for use of simple rounding heuristic.
CGControl getFPump(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a feasibility pump heuristic.
Control variable and prototype for clique cut generator.
void passInMessageHandler(CoinMessageHandler *handler)
Supply a new message handler.
Base class for message handling.
struct CbcGenCtlBlk::redSplitCtl_struct redSplit_
struct CbcGenCtlBlk::twomirCtl_struct twomir_
State of branch-and-cut.
Array of primal variable values for debugging.
bool goodModel_
True if we have a valid model loaded, false otherwise.
Control variable and prototype for flow cover cut generator.
void setGreedyCoverAction(CGControl action)
Set action state for use of greedy cover heuristic.
Control variables for a strong branching method.
Gomory Reduce-and-Split Cut Generator Class; See method generateCuts().
Definition: CglRedSplit.hpp:26
Abstract Base Class for describing an interface to a solver.
CbcHeuristicFPump * proto_
void setCliqueAction(CGControl action)
Set action state for use of clique cut generator.
Gomory Cut Generator Class.
Definition: CglGomory.hpp:14
struct CbcGenCtlBlk::fpumpCtl_struct fpump_
CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model, bool alwaysCreate=true)
Obtain a local search tree object.
Start and end of cbc-generic parameters in parameter vector.
struct CbcGenCtlBlk::greedyCoverCtl_struct greedyCover_
struct CbcGenCtlBlk::cbcParamsInfo_struct cbcParams_
double totalTime_
Total elapsed time for this run.
struct CbcGenCtlBlk::genParamsInfo_struct genParams_
CbcModel * model_
The reference CbcModel object.
This is a first attempt at a message handler.
struct CbcGenCtlBlk::combineCtl_struct combine_
Cut Generator Base Class.
CGControl getMir(CglCutGenerator *&gen)
Obtain a prototype for a mixed integer rounding (MIR) cut generator.
struct CbcGenCtlBlk::babState_struct bab_
Control variable and prototype for feasibility pump heuristic.
CGControl getCombine(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a local search/combine heuristic.
Lifed Simple Generalized Flow Cover Cut Generator Class.
void setKnapsackAction(CGControl action)
Set action state for use of knapsack cut generator.
std::string dfltDirectory_
Default directory prefix.
BACMajor
Major status codes for branch-and-cut.
CGControl getProbing(CglCutGenerator *&gen)
Obtain a prototype for a probing cut generator.
struct CbcGenCtlBlk::mirCtl_struct mir_
void setFlowAction(CGControl action)
Set action state for use of flow cover cut generator.
struct CbcGenCtlBlk::cliqueCtl_struct clique_
void printBaBStatus()
Print the status block.
std::vector< bool > setByUser_
Record of parameters changed by user command.
int printOpt_
When greater than 0, integer presolve gives more information and branch-and-cut provides statistics...
int verbose_
Verbosity level for help messages.
CglMixedIntegerRounding2 * proto_
CbcGenMsgCode
Symbolic names for cbc-generic messages.
BPControl
Codes to specify the assignment of branching priorities.
void setLogLevel(int lvl)
Set log level.
CoinMessageHandler * msgHandler_
Message handler.
Control variable and prototype for greedy equality heuristic.
Start and end of OsiSolverInterface parameters in parameter vector.
std::string printMask_
Print mask.
std::string version_
cbc-generic version
void setCutDepth(int cutDepth)
Set cut depth setting.
CGControl getFlow(CglCutGenerator *&gen)
Obtain a prototype for a flow cover cut generator.
Rounding class.
void setMirAction(CGControl action)
Set action state for use of MIR cut generator.
int logLvl_
The current log level.
bool allowImportErrors_
Allow/disallow errors when importing a model.
CoinParamVec * paramVec_
The parameter vector.
CbcGenCtlBlk()
Default constructor.
CbcHeuristicGreedyEquality * proto_
This file contains the enum that defines symbolic names for for cbc-generic messages.
void setIPPAction(IPPControl action)
Set action state for use of integer preprocessing.
Control variable and prototype for simple rounding heuristic.
IPPControl
Codes to control integer preprocessing.
int getCutDepth()
Get cut depth setting.
CbcHeuristicGreedyCover * proto_
Heuristic base class.
CGControl getRedSplit(CglCutGenerator *&gen)
Obtain a prototype for a reduce and split cut generator.
CGControl getRounding(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a simple rounding heuristic.
Language
Supported languages.
void setMessages(CoinMessages::Language lang=CoinMessages::us_en)
Set up messages in the specified language.
BPControl priorityAction_
Control the assignment of branching priorities to integer variables.
Control variable and prototype for knapsack cover cut generator.
Twostep MIR Cut Generator Class.
Definition: CglTwomir.hpp:91
CGControl getGreedyCover(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a greedy cover heuristic.
void addCbcGenParams(int &numParams, CoinParamVec &paramVec, CbcGenCtlBlk *ctlBlk)
Control variables for local tree.
void setTwomirAction(CGControl action)
Set action state for use of 2-MIR cut generator.
std::string lastMpsIn_
Last MPS input file.
CGControl getGreedyEquality(CbcHeuristic *&gen, CbcModel *model, bool alwaysCreate=true)
Obtain a greedy equality heuristic.
void setTreeLocalAction(CGControl action)
Set action state for use of local tree.
Control variable and prototype for reduce-and-split cut generator.
struct CbcGenCtlBlk::chooseStrongCtl_struct chooseStrong_
BACMinor
Minor status codes.
Odd Hole Cut Generator Class.
Definition: CglOddHole.hpp:14
CGControl getGomory(CglCutGenerator *&gen)
Obtain a prototype for a Gomory cut generator.
OsiSolverInterface * answerSolver_
bool defaultSettings_
False if the user has made nontrivial modifications to the default control settings.
int cutDepth_
Control cut generator activity.
Feasibility Pump class.
CGControl getClique(CglCutGenerator *&gen)
Obtain a prototype for a clique cut generator.
OsiSolverInterface * dfltSolver_
The current default LP solver.
void setGreedyEqualityAction(CGControl action)
Set action state for use of greedy equality heuristic.
Control variable and prototype for greedy cover heuristic.
Greedy heuristic classes.
Knapsack Cover Cut Generator Class.
Simple Branch and bound class.
Definition: CbcModel.hpp:100
Control use of reduced cost fixing prior to B&amp;C.
CoinMessages::Language cur_lang_
The current language.
Control variable and prototype for Gomory cut generator.
int paramsProcessed_
Number of parameters processed.
Probing Cut Generator Class.
Definition: CglProbing.hpp:25
Class to hold and manipulate an array of massaged messages.
void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus, BACWhere where, bool haveAnswer, OsiSolverInterface *answerSolver)
Set the result of branch-and-cut search.
void setLogLevel(int value)
Set current log (detail) level.
CoinMessageHandler * messageHandler() const
Return a pointer to the message handler.
Mixed Integer Rounding Cut Generator Class.
std::string debugFile_
Last debug input file.
BACMajor translateMajor(int status)
Translate CbcModel major status to BACMajor.
CGControl getKnapsack(CglCutGenerator *&gen)
Obtain a prototype for a knapsack cover cut generator.