00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CbcGenCtlBlk_H
00009 #define CbcGenCtlBlk_H
00010
00011
00012
00013
00014
00015 #include "CoinParam.hpp"
00016 #include "CoinMessageHandler.hpp"
00017
00018 #include "CglCutGenerator.hpp"
00019 #include "CglProbing.hpp"
00020 #include "CglClique.hpp"
00021 #include "CglFlowCover.hpp"
00022 #include "CglGomory.hpp"
00023 #include "CglKnapsackCover.hpp"
00024 #include "CglMixedIntegerRounding2.hpp"
00025 #include "CglOddHole.hpp"
00026 #include "CglRedSplit.hpp"
00027 #include "CglTwomir.hpp"
00028
00029 #include "CbcModel.hpp"
00030
00031 #include "CbcHeuristic.hpp"
00032 #include "CbcHeuristicFPump.hpp"
00033 #include "CbcHeuristicGreedy.hpp"
00034 #include "CbcHeuristicLocal.hpp"
00035 #include "CbcTreeLocal.hpp"
00036
00037 #include "CbcGenMessages.hpp"
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #define CBC_GENERIC_VERSION "00.01.00"
00049
00050 class CbcGenCtlBlk ;
00051 namespace CbcGenParamUtils
00052 {
00053 void addCbcGenParams(int &numParams, CoinParamVec ¶mVec,
00054 CbcGenCtlBlk *ctlBlk) ;
00055 }
00056
00057
00058
00059
00060
00061
00062
00063 class CbcGenCtlBlk
00064 {
00065
00066 friend void CbcGenParamUtils::addCbcGenParams(int &numParams,
00067 CoinParamVec ¶mVec, CbcGenCtlBlk *ctlBlk) ;
00068
00069 public:
00070
00073
00074
00075
00076
00077
00078
00096 typedef enum { IPPOff = 0, IPPOn, IPPSave, IPPEqual,
00097 IPPSOS, IPPTrySOS, IPPEqualAll, IPPStrategy } IPPControl ;
00098
00099
00100
00101
00102
00103
00104
00125 typedef enum { CGOff, CGOn, CGRoot, CGIfMove,
00126 CGForceOn, CGForceBut, CGMarker } CGControl ;
00127
00136 typedef enum { BPOff, BPCost, BPOrder, BPExt } BPControl ;
00137
00153 typedef enum { BACInvalid = -1, BACFinish = 0,
00154 BACStop = 1, BACAbandon = 2, BACNotRun, BACUser = 5 } BACMajor ;
00155
00175 typedef enum { BACmInvalid = -1, BACmFinish = 0, BACmInfeas, BACmUbnd,
00176 BACmGap, BACmNodeLimit, BACmTimeLimit, BACmSolnLimit,
00177 BACmUser, BACmOther } BACMinor ;
00178
00188 typedef enum { BACwInvalid = -1, BACwNotStarted = 0, BACwBareRoot,
00189 BACwIPP, BACwIPPRelax, BACwBAC } BACWhere ;
00190
00192
00195
00198 CbcGenCtlBlk() ;
00199
00202 ~CbcGenCtlBlk() ;
00204
00220
00228 inline int getCutDepth() { return cutDepth_ ; }
00229
00235 inline void setCutDepth(int cutDepth) { cutDepth_ = cutDepth ; }
00236
00237
00238
00239 inline IPPControl getIPPAction() { return (preProcess_) ; }
00240
00243 inline void setIPPAction(IPPControl action)
00244 { preProcess_ = action ; }
00245
00248 CGControl getProbing(CglCutGenerator *&gen) ;
00249
00252 inline void setProbingAction(CGControl action)
00253 { probing_.action_ = action ; }
00254
00257 CGControl getClique(CglCutGenerator *&gen) ;
00258
00261 inline void setCliqueAction(CGControl action)
00262 { clique_.action_ = action ; }
00263
00266 CGControl getFlow(CglCutGenerator *&gen) ;
00267
00270 inline void setFlowAction(CGControl action)
00271 { flow_.action_ = action ; }
00272
00275 CGControl getGomory(CglCutGenerator *&gen) ;
00276
00279 inline void setGomoryAction(CGControl action)
00280 { gomory_.action_ = action ; }
00281
00284 CGControl getKnapsack(CglCutGenerator *&gen) ;
00285
00288 inline void setKnapsackAction(CGControl action)
00289 { knapsack_.action_ = action ; }
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00305 CGControl getMir(CglCutGenerator *&gen) ;
00306
00309 inline void setMirAction(CGControl action)
00310 { mir_.action_ = action ; }
00311
00314 CGControl getRedSplit(CglCutGenerator *&gen) ;
00315
00318 inline void setRedSplitAction(CGControl action)
00319 { redSplit_.action_ = action ; }
00320
00323 CGControl getTwomir(CglCutGenerator *&gen) ;
00324
00327 inline void setTwomirAction(CGControl action)
00328 { twomir_.action_ = action ; }
00329
00330
00338 CGControl getFPump(CbcHeuristic *&gen, CbcModel *model,
00339 bool alwaysCreate = true) ;
00340
00343 inline void setFPumpAction(CGControl action)
00344 { fpump_.action_ = action ; }
00345
00353 CGControl getCombine(CbcHeuristic *&gen, CbcModel *model,
00354 bool alwaysCreate = true) ;
00355
00358 inline void setCombineAction(CGControl action)
00359 { combine_.action_ = action ; }
00360
00368 CGControl getGreedyCover(CbcHeuristic *&gen, CbcModel *model,
00369 bool alwaysCreate = true) ;
00370
00373 inline void setGreedyCoverAction(CGControl action)
00374 { greedyCover_.action_ = action ; }
00375
00383 CGControl getGreedyEquality(CbcHeuristic *&gen, CbcModel *model,
00384 bool alwaysCreate = true) ;
00385
00388 inline void setGreedyEqualityAction(CGControl action)
00389 { greedyEquality_.action_ = action ; }
00390
00398 CGControl getRounding(CbcHeuristic *&gen, CbcModel *model,
00399 bool alwaysCreate = true) ;
00400
00403 inline void setRoundingAction(CGControl action)
00404 { rounding_.action_ = action ; }
00405
00413 CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model,
00414 bool alwaysCreate = true) ;
00415
00418 inline void setTreeLocalAction(CGControl action)
00419 { localTree_.action_ = action ; }
00420
00422
00427
00430 inline void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus,
00431 BACWhere where, bool haveAnswer,
00432 OsiSolverInterface *answerSolver)
00433 { bab_.majorStatus_ = majorStatus ;
00434 bab_.minorStatus_ = minorStatus ;
00435 bab_.where_ = where ;
00436 bab_.haveAnswer_ = haveAnswer ;
00437 bab_.answerSolver_ = answerSolver ; }
00438
00444 void setBaBStatus(const CbcModel *model, BACWhere where,
00445 bool haveAnswer = false,
00446 OsiSolverInterface *answerSolver = 0) ;
00447
00452 BACMajor translateMajor(int status) ;
00453
00458 BACMinor translateMinor(int status) ;
00459
00465 BACMinor translateMinor(const OsiSolverInterface *osi) ;
00466
00469 void printBaBStatus() ;
00470
00472
00475
00480 CoinMessageHandler &message(CbcGenMsgCode inID) ;
00481
00487 void passInMessageHandler(CoinMessageHandler *handler) ;
00488
00490 inline CoinMessageHandler *messageHandler() const { return msgHandler_ ; }
00491
00504 void setMessages(CoinMessages::Language lang = CoinMessages::us_en) ;
00505
00507 inline void setLogLevel(int lvl)
00508 { logLvl_ = lvl ;
00509 if (msgHandler_) msgHandler_->setLogLevel(lvl) ; }
00510
00512 inline int logLevel() const { return (logLvl_) ; }
00513
00517 int printOpt_ ;
00518
00520
00525 std::string version_ ;
00526
00529 std::string dfltDirectory_ ;
00530
00533 std::string lastMpsIn_ ;
00534
00536 bool allowImportErrors_ ;
00537
00540 std::string lastSolnOut_ ;
00541
00548 int printMode_ ;
00549
00555 std::string printMask_ ;
00556
00559 CoinParamVec *paramVec_ ;
00560
00563 struct genParamsInfo_struct
00564 { int first_ ;
00565 int last_ ; } genParams_ ;
00566
00569 struct cbcParamsInfo_struct
00570 { int first_ ;
00571 int last_ ; } cbcParams_ ;
00572
00577 struct osiParamsInfo_struct
00578 { int first_ ;
00579 int last_ ; } osiParams_ ;
00580
00590 int verbose_ ;
00591
00594 int paramsProcessed_ ;
00595
00598 std::vector<bool> setByUser_ ;
00599
00606 bool defaultSettings_ ;
00607
00616 std::string debugCreate_ ;
00617
00624 std::string debugFile_ ;
00625
00631 struct debugSolInfo_struct
00632 { int numCols_ ;
00633 double *values_ ; } debugSol_ ;
00635
00636
00638
00641 double totalTime_ ;
00642
00644
00647
00658 CbcModel *model_ ;
00659
00666 OsiSolverInterface *dfltSolver_ ;
00667
00670 bool goodModel_ ;
00671
00679 struct babState_struct
00680 { BACMajor majorStatus_ ;
00681 BACMinor minorStatus_ ;
00682 BACWhere where_ ;
00683 bool haveAnswer_ ;
00684 OsiSolverInterface *answerSolver_ ; } bab_ ;
00685
00687
00690
00699 struct djFixCtl_struct
00700 { bool action_ ;
00701 double threshold_ ; } djFix_ ;
00702
00706 BPControl priorityAction_ ;
00707
00709
00716
00724 struct chooseStrongCtl_struct
00725 { int numBeforeTrust_ ;
00726 int numStrong_ ;
00727 int shadowPriceMode_ ; } chooseStrong_ ;
00729
00730 private:
00731
00736
00739 IPPControl preProcess_ ;
00740
00747 int cutDepth_ ;
00748
00750 struct probingCtl_struct
00751 { CGControl action_ ;
00752 CglProbing *proto_ ;
00753 bool usingObjective_ ;
00754 int maxPass_ ;
00755 int maxPassRoot_ ;
00756 int maxProbe_ ;
00757 int maxProbeRoot_ ;
00758 int maxLook_ ;
00759 int maxLookRoot_ ;
00760 int maxElements_ ;
00761 int rowCuts_ ; } probing_ ;
00762
00764 struct cliqueCtl_struct
00765 { CGControl action_ ;
00766 CglClique *proto_ ;
00767 bool starCliqueReport_ ;
00768 bool rowCliqueReport_ ;
00769 double minViolation_ ; } clique_ ;
00770
00772 struct flowCtl_struct
00773 { CGControl action_ ;
00774 CglFlowCover *proto_ ; } flow_ ;
00775
00777 struct gomoryCtl_struct
00778 { CGControl action_ ;
00779 CglGomory *proto_ ;
00780 int limit_ ;
00781 int limitAtRoot_ ; } gomory_ ;
00782
00783
00784
00785
00786
00787
00788
00789
00791 struct knapsackCtl_struct
00792 { CGControl action_ ;
00793 CglKnapsackCover *proto_ ; } knapsack_ ;
00794
00796 struct mirCtl_struct
00797 { CGControl action_ ;
00798 CglMixedIntegerRounding2 *proto_ ; } mir_ ;
00799
00801 struct oddHoleCtl_struct
00802 { CGControl action_ ;
00803 CglOddHole *proto_ ; } oddHole_ ;
00804
00808 struct redSplitCtl_struct
00809 { CGControl action_ ;
00810 CglRedSplit *proto_ ; } redSplit_ ;
00811
00813 struct twomirCtl_struct
00814 { CGControl action_ ;
00815 CglTwomir *proto_ ;
00816 int maxElements_ ; } twomir_ ;
00817
00819 struct fpumpCtl_struct
00820 { CGControl action_ ;
00821 CbcHeuristicFPump *proto_ ;
00822 int iters_ ; } fpump_ ;
00823
00825 struct combineCtl_struct
00826 { CGControl action_ ;
00827 CbcHeuristicLocal *proto_ ;
00828 int trySwap_ ; } combine_ ;
00829
00831 struct greedyCoverCtl_struct
00832 { CGControl action_ ;
00833 CbcHeuristicGreedyCover *proto_ ; } greedyCover_ ;
00834
00836 struct greedyEqualityCtl_struct
00837 { CGControl action_ ;
00838 CbcHeuristicGreedyEquality *proto_ ; } greedyEquality_ ;
00839
00841 struct roundingCtl_struct
00842 { CGControl action_ ;
00843 CbcRounding *proto_ ; } rounding_ ;
00844
00845
00852 struct localTreeCtl_struct
00853 { CGControl action_ ;
00854 CbcTreeLocal *proto_ ;
00855 double *soln_ ;
00856 int range_ ;
00857 int typeCuts_ ;
00858 int maxDiverge_ ;
00859 int timeLimit_ ;
00860 int nodeLimit_ ;
00861 bool refine_ ; } localTree_ ;
00862
00864
00870
00872 CoinMessageHandler *msgHandler_ ;
00873
00880 bool ourMsgHandler_ ;
00881
00883 CoinMessages::Language cur_lang_ ;
00884
00886 CoinMessages *msgs_ ;
00887
00889 int logLvl_ ;
00890
00892
00893 } ;
00894
00895
00896 #endif