source: trunk/Cbc/src/CbcGenCtlBlk.hpp @ 1464

Last change on this file since 1464 was 1464, checked in by stefan, 9 years ago

merge split branch into trunk; fix some examples

File size: 28.0 KB
RevLine 
[640]1/*
2  Copyright (C) 2007, Lou Hafer, International Business Machines Corporation
3  and others.  All Rights Reserved.
4
5  This file is part of cbc-generic.
6*/
7
8#ifndef CbcGenCtlBlk_H
9#define CbcGenCtlBlk_H
10
11/* \file CbcGenCtlBlk.hpp
12   \brief Declarations for parameters of the cbc-generic main program.
13*/
14
15#include "CoinParam.hpp"
16#include "CoinMessageHandler.hpp"
17
18#include "CglCutGenerator.hpp"
19#include "CglProbing.hpp"
20#include "CglClique.hpp"
21#include "CglFlowCover.hpp"
22#include "CglGomory.hpp"
23#include "CglKnapsackCover.hpp"
24#include "CglMixedIntegerRounding2.hpp"
25#include "CglOddHole.hpp"
26#include "CglRedSplit.hpp"
27#include "CglTwomir.hpp"
28
29#include "CbcModel.hpp"
30
31#include "CbcHeuristic.hpp"
32#include "CbcHeuristicFPump.hpp"
33#include "CbcHeuristicGreedy.hpp"
34#include "CbcHeuristicLocal.hpp"
35#include "CbcTreeLocal.hpp"
36
37#include "CbcGenMessages.hpp"
38
39/*
40  It turns out that doxygen is not good with anonymous structures. Hence the
41  `struct nameCtl_struct' style used for structured fields in CbcGenCtlBlk.
42*/
43
44/*
[1271]45  $Id: CbcGenCtlBlk.hpp 1173 2009-06-04 09:44:10Z forrest $
[640]46*/
47
48#define CBC_GENERIC_VERSION "00.01.00"
49
50class CbcGenCtlBlk ;
[1286]51namespace CbcGenParamUtils {
52void addCbcGenParams(int &numParams, CoinParamVec &paramVec,
53                     CbcGenCtlBlk *ctlBlk) ;
[640]54}
55
56/* \brief cbc-generic algorithm control class
57
58  This class defines values and methods used to control the operation of the
59  cbc-generic main program.
60*/
61
[1286]62class CbcGenCtlBlk {
[640]63
[1286]64    friend void CbcGenParamUtils::addCbcGenParams(int &numParams,
65            CoinParamVec &paramVec, CbcGenCtlBlk *ctlBlk) ;
[640]66
67public:
68
[1286]69    /*! \name Enumeration types used for cbc-generic control variables */
[640]70//@{
71
[1286]72    /*
73      In order for initialisation to work properly, the order of declaration of
74      the enum constants here must match the order of keyword declaration for
75      the PREPROCESS parameter in CbcGenParamUtils::addCbcGenParams
76    */
77    /*! \brief Codes to control integer preprocessing
[640]78
[1286]79      - IPPOff: Integer preprocessing is off.
80      - IPPOn:  Integer preprocessing is on.
81      - IPPSave: IPPOn, plus preprocessed system will be saved to presolved.mps.
82      - IPPEqual: IPPOn, plus `<=' cliques are converted to `=' cliques.
83      - IPPSOS: IPPOn, plus will create SOS sets (see below).
84      - IPPTrySOS: IPPOn, plus will create SOS sets (see below).
85      - IPPEqualAll: IPPOn, plus turns all valid inequalities into equalities
86                with integer slacks.
87      - IPPStrategy: look to CbcStrategy object for instructions.
[640]88
[1286]89      IPPSOS will create SOS sets if all binary variables (except perhaps one)
90      can be covered by SOS sets with no overlap between sets. IPPTrySOS will
91      allow any number of binary variables to be uncovered.
92    */
[640]93
[1286]94    typedef enum { IPPOff = 0, IPPOn, IPPSave, IPPEqual,
95                   IPPSOS, IPPTrySOS, IPPEqualAll, IPPStrategy
96                 } IPPControl ;
[640]97
[1286]98    /*
99      In order for initialisation to work properly, the order of declaration of
100      the enum constants here must match the order of keyword declaration for
101      the various cut and heuristic control parameters in
102      CbcGenParamUtils::addCbcGenParams
103    */
104    /*! \brief Codes to control the use of cut generators and heuristics
[640]105
[1286]106      - CGOff: the cut generator will not be installed
107      - CGOn:  the cut generator will be installed; exactly how often it's
108           activated depends on the settings at installation
109      - CGRoot: the cut generator will be installed with settings that restrict
110           it to activation at the root node only.
111      - CGIfMove: the cut generator will be installed with settings that allow
112           it to remain active only so long as it's generating cuts that
113           tighten the relaxation.
114      - CGForceOn: the cut generator will be installed with settings that force
115           it to be called at every node
116      - CGForceBut: the cut generator will be installed with settings that force
117           it to be called at every node, but more active at root (probing
118           only)
119      - CGMarker: a convenience to mark the end of the codes.
[640]120
[1286]121      The same codes are used for heuristics.
122    */
[640]123
[1286]124    typedef enum { CGOff, CGOn, CGRoot, CGIfMove,
125                   CGForceOn, CGForceBut, CGMarker
126                 } CGControl ;
[640]127
[1286]128    /*! \brief Codes to specify the assignment of branching priorities
[640]129
[1286]130      - BPOff: no priorities are passed to cbc
131      - BPCost: a priority vector is constructed based on objective coefficients
132      - BPOrder: a priority vector is constructed based on column order
133      - BPExt: the user has provided a priority vector
134    */
[640]135
[1286]136    typedef enum { BPOff, BPCost, BPOrder, BPExt } BPControl ;
[640]137
[1286]138    /*! \brief Major status codes for branch-and-cut
[640]139
[1286]140      - BACInvalid: status not yet set
141      - BACNotRun: branch-and-cut has not yet run for the current problem
142      - BACFinish: branch-and-cut has finished normally
143      - BACStop: branch-and-cut has stopped on a limit
144      - BACAbandon: branch-and-cut abandoned the problem
145      - BACUser: branch-and-cut stopped on user signal
[640]146
[1286]147      Consult minorStatus_ for details.
[640]148
[1286]149      These codes are (mostly) set to match the codes used by CbcModel. Additions
150      to CbcModel codes should be reflected here and in translateMajor.
151    */
[640]152
[1286]153    typedef enum { BACInvalid = -1, BACFinish = 0,
154                   BACStop = 1, BACAbandon = 2, BACNotRun, BACUser = 5
155                 } BACMajor ;
[640]156
[1286]157    /*! \brief Minor status codes
[640]158
[1286]159      - BACmInvalid             status not yet set
160      - BACmFinish              search exhausted the tree; optimal solution found
161      - BACmInfeas              problem is infeasible
162      - BACmUbnd                problem is unbounded
163      - BACmGap         stopped on integrality gap
164      - BACmNodeLimit   stopped on node limit
165      - BACmTimeLimit   stopped on time limit
166      - BACmSolnLimit   stopped on number of solutions limit
167      - BACmUser                stopped due to user event
168      - BACmOther               nothing else is appropriate
[640]169
[1286]170      It's not possible to make these codes agree with CbcModel. The meaning varies
171      according to context: if the BACWhere code specifies a relaxation, then the
172      minor status reflects the underlying OSI solver. Otherwise, it reflects the
173      integer problem.
174    */
[640]175
[1286]176    typedef enum { BACmInvalid = -1, BACmFinish = 0, BACmInfeas, BACmUbnd,
177                   BACmGap, BACmNodeLimit, BACmTimeLimit, BACmSolnLimit,
178                   BACmUser, BACmOther
179                 } BACMinor ;
[640]180
[1286]181    /*! \brief Codes to specify where branch-and-cut stopped
[640]182
[1286]183      - BACwNotStarted  stopped before we ever got going
184      - BACwBareRoot    stopped after initial solve of root relaxation
185      - BACwIPP         stopped after integer preprocessing
186      - BACwIPPRelax    stopped after initial solve of preprocessed problem
187      - BACwBAC         stopped at some point in branch-and-cut
188    */
[640]189
[1286]190    typedef enum { BACwInvalid = -1, BACwNotStarted = 0, BACwBareRoot,
191                   BACwIPP, BACwIPPRelax, BACwBAC
192                 } BACWhere ;
[640]193
194//@}
[1286]195
196    /*! \name Constructors and destructors */
[640]197//@{
198
[1286]199    /*! \brief Default constructor */
[640]200
[1286]201    CbcGenCtlBlk() ;
[640]202
[1286]203    /*! \brief Destructor */
[640]204
[1286]205    ~CbcGenCtlBlk() ;
[640]206//@}
207
[1286]208    /*! \name Access and Control Functions for Cut Generators and Heuristics
209        \brief Control functions, plus lazy creation functions for cut generators
210           and heuristics
[640]211
[1286]212        cbc-generic avoids creating objects for cut generators and heuristics
213        unless they're actually used. For cut generators, a prototype is created
214        and reused. For heuristics, the default is to create a new object with each
215        call, because the model may have changed. The object is returned through
216        the reference parameter. The return value of the function is the current
217        action state.
[640]218
[1286]219        Cut generator and heuristic objects created by these calls will be deleted
220        with the destruction of the CbcGenCtlBlk object.
221    */
[640]222//@{
223
[1286]224    /*! \brief Get cut depth setting
[640]225
[1286]226      The name is a bit of a misnomer. Essentially, this overrides the
227      `every so many nodes' control with `execute when (depth in tree)
228      mod (cut depth) == 0'.
229    */
[640]230
[1286]231    inline int getCutDepth() {
232        return cutDepth_ ;
233    }
[640]234
[1286]235    /*! \brief Set cut depth setting.
[640]236
[1286]237      See comments for getCutDepth().
238    */
[640]239
[1286]240    inline void setCutDepth(int cutDepth) {
241        cutDepth_ = cutDepth ;
242    }
[640]243
[1286]244    /*1 \brief Get action state for use of integer preprocessing */
[640]245
[1286]246    inline IPPControl getIPPAction() {
247        return (preProcess_) ;
248    }
[640]249
[1286]250    /*! \brief Set action state for use of integer preprocessing */
[640]251
[1286]252    inline void setIPPAction(IPPControl action) {
253        preProcess_ = action ;
254    }
[640]255
[1286]256    /*! \brief Obtain a prototype for a probing cut generator. */
[640]257
[1286]258    CGControl getProbing(CglCutGenerator *&gen) ;
[640]259
[1286]260    /*! \brief Set action state for use of probing cut generator. */
[640]261
[1286]262    inline void setProbingAction(CGControl action) {
263        probing_.action_ = action ;
264    }
[640]265
[1286]266    /*! \brief Obtain a prototype for a clique cut generator. */
[640]267
[1286]268    CGControl getClique(CglCutGenerator *&gen) ;
[640]269
[1286]270    /*! \brief Set action state for use of clique cut generator. */
[640]271
[1286]272    inline void setCliqueAction(CGControl action) {
273        clique_.action_ = action ;
274    }
[640]275
[1286]276    /*! \brief Obtain a prototype for a flow cover cut generator. */
[640]277
[1286]278    CGControl getFlow(CglCutGenerator *&gen) ;
[640]279
[1286]280    /*! \brief Set action state for use of flow cover cut generator. */
[640]281
[1286]282    inline void setFlowAction(CGControl action) {
283        flow_.action_ = action ;
284    }
[640]285
[1286]286    /*! \brief Obtain a prototype for a Gomory cut generator. */
[640]287
[1286]288    CGControl getGomory(CglCutGenerator *&gen) ;
[640]289
[1286]290    /*! \brief Set action state for use of Gomory cut generator. */
[640]291
[1286]292    inline void setGomoryAction(CGControl action) {
293        gomory_.action_ = action ;
294    }
[640]295
[1286]296    /*! \brief Obtain a prototype for a knapsack cover cut generator. */
[640]297
[1286]298    CGControl getKnapsack(CglCutGenerator *&gen) ;
[640]299
[1286]300    /*! \brief Set action state for use of knapsack cut generator. */
[640]301
[1286]302    inline void setKnapsackAction(CGControl action) {
303        knapsack_.action_ = action ;
304    }
[640]305
[1286]306    /*  \brief Obtain a prototype for a lift-and-project cut generator.
[640]307
[1286]308      CGControl getLandP(CglCutGenerator *&gen) ;
[640]309
[1286]310       \brief Set action state for use of lift-and-project cut generator.
[640]311
[1286]312      inline void setLandPAction(CGControl action)
313      { landp_.action_ = action ; }
314    */
[640]315
[1286]316    /*! \brief Obtain a prototype for a mixed integer rounding (MIR)
317           cut generator.
318    */
[640]319
[1286]320    CGControl getMir(CglCutGenerator *&gen) ;
[640]321
[1286]322    /*! \brief Set action state for use of MIR cut generator. */
[640]323
[1286]324    inline void setMirAction(CGControl action) {
325        mir_.action_ = action ;
326    }
[640]327
[1286]328    /*! \brief Obtain a prototype for a reduce and split cut generator. */
[640]329
[1286]330    CGControl getRedSplit(CglCutGenerator *&gen) ;
[640]331
[1286]332    /*! \brief Set action state for use of reduce and split cut generator. */
[640]333
[1286]334    inline void setRedSplitAction(CGControl action) {
335        redSplit_.action_ = action ;
336    }
[640]337
[1286]338    /*! \brief Obtain a prototype for a 2-MIR cut generator. */
[640]339
[1286]340    CGControl getTwomir(CglCutGenerator *&gen) ;
[640]341
[1286]342    /*! \brief Set action state for use of 2-MIR cut generator. */
[640]343
[1286]344    inline void setTwomirAction(CGControl action) {
345        twomir_.action_ = action ;
346    }
[640]347
348
[1286]349    /*! \brief Obtain a feasibility pump heuristic.
[640]350
[1286]351      By default, any existing object is deleted and a new object is created and
352      loaded with \c model. Set alwaysCreate = false to return an existing object
353      if one exists.
354    */
[640]355
[1286]356    CGControl getFPump(CbcHeuristic *&gen, CbcModel *model,
357                       bool alwaysCreate = true) ;
[640]358
[1286]359    /*! \brief Set action state for use of feasibility pump heuristic. */
[640]360
[1286]361    inline void setFPumpAction(CGControl action) {
362        fpump_.action_ = action ;
363    }
[640]364
[1286]365    /*! \brief Obtain a local search/combine heuristic.
[640]366
[1286]367      By default, any existing object is deleted and a new object is created and
368      loaded with \c model. Set alwaysCreate = false to return an existing object
369      if one exists.
370    */
[640]371
[1286]372    CGControl getCombine(CbcHeuristic *&gen, CbcModel *model,
373                         bool alwaysCreate = true) ;
[640]374
[1286]375    /*! \brief Set action state for use of local search/combine heuristic. */
[640]376
[1286]377    inline void setCombineAction(CGControl action) {
378        combine_.action_ = action ;
379    }
[640]380
[1286]381    /*! \brief Obtain a greedy cover heuristic.
[640]382
[1286]383      By default, any existing object is deleted and a new object is created and
384      loaded with \c model. Set alwaysCreate = false to return an existing object
385      if one exists.
386    */
[640]387
[1286]388    CGControl getGreedyCover(CbcHeuristic *&gen, CbcModel *model,
389                             bool alwaysCreate = true) ;
[640]390
[1286]391    /*! \brief Set action state for use of greedy cover heuristic. */
[640]392
[1286]393    inline void setGreedyCoverAction(CGControl action) {
394        greedyCover_.action_ = action ;
395    }
[640]396
[1286]397    /*! \brief Obtain a greedy equality heuristic.
[640]398
[1286]399      By default, any existing object is deleted and a new object is created and
400      loaded with \c model. Set alwaysCreate = false to return an existing object
401      if one exists.
402    */
[640]403
[1286]404    CGControl getGreedyEquality(CbcHeuristic *&gen, CbcModel *model,
405                                bool alwaysCreate = true) ;
[640]406
[1286]407    /*! \brief Set action state for use of greedy equality heuristic. */
[640]408
[1286]409    inline void setGreedyEqualityAction(CGControl action) {
410        greedyEquality_.action_ = action ;
411    }
[640]412
[1286]413    /*! \brief Obtain a simple rounding heuristic.
[640]414
[1286]415      By default, any existing object is deleted and a new object is created and
416      loaded with \c model. Set alwaysCreate = false to return an existing object
417      if one exists.
418    */
[640]419
[1286]420    CGControl getRounding(CbcHeuristic *&gen, CbcModel *model,
421                          bool alwaysCreate = true) ;
[640]422
[1286]423    /*! \brief Set action state for use of simple rounding heuristic. */
424
425    inline void setRoundingAction(CGControl action) {
426        rounding_.action_ = action ;
427    }
428
429    /*! \brief Obtain a local search tree object
430
431      By default, any existing object is deleted and a new object is created and
432      loaded with \c model. Set alwaysCreate = false to return an existing object
433      if one exists.
434    */
435
436    CGControl getTreeLocal(CbcTreeLocal *&localTree, CbcModel *model,
437                           bool alwaysCreate = true) ;
438
439    /*! \brief Set action state for use of local tree. */
440
441    inline void setTreeLocalAction(CGControl action) {
442        localTree_.action_ = action ;
443    }
444
[640]445//@}
446
[1286]447    /*! \name Status Functions
448        \brief Convenience routines for status codes.
449    */
[640]450//@{
451
[1286]452    /*! \brief Set the result of branch-and-cut search */
[640]453
[1286]454    inline void setBaBStatus(BACMajor majorStatus, BACMinor minorStatus,
455                             BACWhere where, bool haveAnswer,
456                             OsiSolverInterface *answerSolver) {
457        bab_.majorStatus_ = majorStatus ;
458        bab_.minorStatus_ = minorStatus ;
459        bab_.where_ = where ;
460        bab_.haveAnswer_ = haveAnswer ;
461        bab_.answerSolver_ = answerSolver ;
462    }
[640]463
[1286]464    /*! \brief Set the result of branch-and-cut search
[640]465
[1286]466      This version will extract the necessary information from the CbcModel
467      object and set appropriate status based on the value passed for where.
468    */
469    void setBaBStatus(const CbcModel *model, BACWhere where,
470                      bool haveAnswer = false,
471                      OsiSolverInterface *answerSolver = 0) ;
[640]472
[1286]473    /*! \brief Translate CbcModel major status to #BACMajor
[640]474
[1286]475      See the #BACMajor enum for details.
476    */
477    BACMajor translateMajor(int status) ;
[640]478
[1286]479    /*!\brief Translate CbcModel minor status to #BACMinor
[640]480
[1286]481      See the #BACMinor enum for details.
482    */
483    BACMinor translateMinor(int status) ;
[640]484
[1286]485    /*!\brief Translate OsiSolverInterface status to #BACMinor
[640]486
[1286]487      See the #BACMinor enum for details. Optimal, infeasible, and unbounded
488      get their own codes; everything else maps to BACmOther.
489    */
490    BACMinor translateMinor(const OsiSolverInterface *osi) ;
[640]491
[1286]492    /*! \brief Print the status block */
493
494    void printBaBStatus() ;
495
[640]496//@}
497
[1286]498    /*! \name Messages and statistics */
[640]499//@{
500
[1286]501    /*! \brief Print a message
[640]502
[1286]503      Uses the current message handler and messages.
504    */
505    CoinMessageHandler &message(CbcGenMsgCode inID) ;
[640]506
[1286]507    /*! \brief Supply a new message handler.
[640]508
[1286]509      Replaces the current message handler. The current handler is destroyed
510      if ourMsgHandler_ is true, and the call will set ourMsgHandler_ = true.
511    */
512    void passInMessageHandler(CoinMessageHandler *handler) ;
[640]513
[1286]514    /*! \brief Return a pointer to the message handler */
515    inline CoinMessageHandler *messageHandler() const {
516        return msgHandler_ ;
517    }
[640]518
[1286]519    /*! \brief Set up messages in the specified language.
[640]520
[1286]521      Building a set of messages in a given language implies rebuilding the
522      whole set of messages, for reasons explained in the body of the code.
523      Hence there's no separate setLanguage routine. Use this routine for the
524      initial setup of messages and any subsequent change in language. Note
525      that the constructor gives you a message handler by default, but \e not
526      messages. You need to call setMessages explicitly.
[640]527
[1286]528      The default value specified here for lang effectively sets the default
529      language.
530    */
531    void setMessages(CoinMessages::Language lang = CoinMessages::us_en) ;
[640]532
[1286]533    /*! \brief Set log level */
534    inline void setLogLevel(int lvl) {
535        logLvl_ = lvl ;
536        if (msgHandler_) msgHandler_->setLogLevel(lvl) ;
537    }
[640]538
[1286]539    /*! \brief Get log level */
540    inline int logLevel() const {
541        return (logLvl_) ;
542    }
[640]543
[1286]544    /*! \brief When greater than 0, integer presolve gives more information and
545           branch-and-cut provides statistics.
546    */
547    int printOpt_ ;
[640]548
549//@}
550
[1286]551    /*! \name Parameter parsing and input/output. */
[640]552//@{
[1286]553    /*! \brief cbc-generic version */
[640]554
[1286]555    std::string version_ ;
[640]556
[1286]557    /*! \brief Default directory prefix */
[640]558
[1286]559    std::string dfltDirectory_ ;
[640]560
[1286]561    /*! \brief Last MPS input file */
[640]562
[1286]563    std::string lastMpsIn_ ;
[640]564
[1286]565    /*! \brief Allow/disallow errors when importing a model */
566    bool allowImportErrors_ ;
[640]567
[1286]568    /*! \brief Last solution output file */
[640]569
[1286]570    std::string lastSolnOut_ ;
[640]571
[1286]572    /*! \brief Solution printing mode
[640]573
[1286]574      Controls the amount of information printed when printing a solution.
575      Coding is set by the keyword declarations for the printingOptions
576      command.
577    */
578    int printMode_ ;
[640]579
[1286]580    /*! \brief Print mask
[640]581
[1286]582      Used to specify row/column names to be printed. Not implemented as of
583      060920.
584    */
585    std::string printMask_ ;
[640]586
[1286]587    /*! \brief The parameter vector */
[640]588
[1286]589    CoinParamVec *paramVec_ ;
[640]590
[1286]591    /*! \brief Start and end of cbc-generic parameters in parameter vector */
[640]592
[1286]593    struct genParamsInfo_struct {
594        int first_ ;
595        int last_ ;
596    } genParams_ ;
[640]597
[1286]598    /*! \brief Start and end of CbcModel parameters in parameter vector */
[640]599
[1286]600    struct cbcParamsInfo_struct {
601        int first_ ;
602        int last_ ;
603    } cbcParams_ ;
[640]604
[1286]605    /*! \brief Start and end of OsiSolverInterface  parameters in parameter
606           vector
607    */
[640]608
[1286]609    struct osiParamsInfo_struct {
610        int first_ ;
611        int last_ ;
612    } osiParams_ ;
[640]613
[1286]614    /*! \brief Verbosity level for help messages.
[640]615
[1286]616      Interpretation is bitwise:
617      - (0): short help
618      - (1): long help
619      - (2): unused (for compatibility with cbc; indicates AMPL)
620      - (3): show parameters with display = false.
621    */
[640]622
[1286]623    int verbose_ ;
[640]624
[1286]625    /*! \brief Number of parameters processed */
[640]626
[1286]627    int paramsProcessed_ ;
[640]628
[1286]629    /*! \brief Record of parameters changed by user command */
[640]630
[1286]631    std::vector<bool> setByUser_ ;
[640]632
[1286]633    /*! \brief False if the user has made nontrivial modifications to the
634           default control settings.
[640]635
[1286]636      Initially true. Specifying DJFIX, TIGHTENFACTOR, or any cut or heuristic
637      parameter will set this to false.
638    */
639    bool defaultSettings_ ;
[640]640
[1286]641    /*! \brief Control debug file creation
[640]642
[1286]643      At the conclusion of branch-and-cut, dump the full solution in a binary
644      format to debug.file in the current directory.  When set to
645      "createAfterPre", the solution is dumped before integer presolve
646      transforms are removed.  When set to "create", the solution is dumped
647      after integer presolve transforms are backed out.
648    */
649    std::string debugCreate_ ;
[640]650
[1286]651    /*! \brief Last debug input file
[640]652
[1286]653      The file is expected to be in a binary format understood by
654      activateRowCutDebugger.
655    */
[640]656
[1286]657    std::string debugFile_ ;
[640]658
[1286]659    /*! \brief Array of primal variable values for debugging
660
661      Used to provide a known optimal solution to activateRowCutDebugger().
662    */
663
664    struct debugSolInfo_struct {
665        int numCols_ ;
666        double *values_ ;
667    } debugSol_ ;
[640]668//@}
669
[1286]670    /* \name Timing */
[640]671//@{
672
[1286]673    /*! \brief Total elapsed time for this run. */
[640]674
[1286]675    double totalTime_ ;
[640]676
677//@}
678
[1286]679    /*! \name Models of various flavours */
[640]680//@{
681
[1286]682    /*! \brief The reference CbcModel object.
[640]683
[1286]684      This is the CbcModel created when cbc-generic boots up. It holds the
685      default solver with the current constraint system. CbcCbcParam parameters
686      are applied here, and CbcOsiParam parameters are applied to the solver.
687      Major modifications for branch-and-cut (integer preprocessing,
688      installation of heuristics and cut generators) are performed on a clone.
689      The solution is transferred back into this object.
690    */
[640]691
[1286]692    CbcModel *model_ ;
[640]693
[1286]694    /*! \brief The current default LP solver
[640]695
[1286]696      This is a pointer to a reference copy. If you want the solver associated
697      with #model_, ask for it directly.
698    */
[640]699
[1286]700    OsiSolverInterface *dfltSolver_ ;
[640]701
[1286]702    /*! \brief True if we have a valid model loaded, false otherwise. */
[640]703
[1286]704    bool goodModel_ ;
[640]705
[1286]706    /*! \brief State of branch-and-cut
[640]707
[1286]708      Major and minor status codes, and a solver holding the answer, assuming
709      we have a valid answer. See the documentation with the BACMajor,
710      BACMinor, and BACWhere enums for the meaning of the codes.
711    */
[640]712
[1286]713    struct babState_struct {
714        BACMajor majorStatus_ ;
715        BACMinor minorStatus_ ;
716        BACWhere where_ ;
717        bool haveAnswer_ ;
718        OsiSolverInterface *answerSolver_ ;
719    } bab_ ;
720
[640]721//@}
722
[1286]723    /*! \name Various algorithm control variables and settings */
[640]724//@{
725
[1286]726    /*! \brief Control use of reduced cost fixing prior to B&C
[640]727
[1286]728      This heuristic fixes variables whose reduced cost for the root
729      relaxtion exceeds the specified threshold. This is purely a heuristic,
730      performed before there's any incumbent solution. It may well fix variables
731      at the wrong bound!
732    */
[640]733
[1286]734    struct djFixCtl_struct {
735        bool action_ ;
736        double threshold_ ;
737    } djFix_ ;
[640]738
[1286]739    /*! \brief Control the assignment of branching priorities to integer
740           variables.
741    */
742    BPControl priorityAction_ ;
[640]743
744//@}
745
[1286]746    /*! \name Branching Method Control
747        \brief Usage control and prototypes for branching methods.
[640]748
[1286]749        Looking to the future, this covers only OsiChoose methods.
750    */
[640]751//@{
752
[1286]753    /*! \brief Control variables for a strong branching method.
754
755      Consult OsiChooseVariable and CbcModel for details. An artifact of the
756      changeover from CbcObjects to OsiObjects is that the number of uses before
757      pseudo costs are trusted (numBeforeTrust_) and the number of variables
758      evaluated with strong branching (numStrong_) are parameters of CbcModel.
759    */
760    struct chooseStrongCtl_struct {
761        int numBeforeTrust_ ;
762        int numStrong_ ;
763        int shadowPriceMode_ ;
764    } chooseStrong_ ;
[640]765//@}
766
767private:
768
[1286]769    /*! \name Cut Generator and Heuristic Control
770        \brief Usage control and prototypes for cut generators and heuristics.
771    */
[640]772//@{
773
[1286]774    /*! \brief Control integer preprocessing. */
[640]775
[1286]776    IPPControl preProcess_ ;
[640]777
[1286]778    /*! \brief Control cut generator activity
[640]779
[1286]780      Generators that are active in the tree will be activated when
781      (depth) mod (cutDepth) == 0.
782    */
[640]783
[1286]784    int cutDepth_ ;
[640]785
[1286]786    /*! \brief Control variable and prototype for probing cut generator */
787    struct probingCtl_struct {
788        CGControl action_ ;
789        CglProbing *proto_ ;
790        bool usingObjective_ ;
791        int maxPass_ ;
792        int maxPassRoot_ ;
793        int maxProbe_ ;
794        int maxProbeRoot_ ;
795        int maxLook_ ;
796        int maxLookRoot_ ;
797        int maxElements_ ;
798        int rowCuts_ ;
799    } probing_ ;
[640]800
[1286]801    /*! \brief Control variable and prototype for clique cut generator */
802    struct cliqueCtl_struct {
803        CGControl action_ ;
804        CglClique *proto_ ;
805        bool starCliqueReport_ ;
806        bool rowCliqueReport_ ;
807        double minViolation_ ;
808    } clique_ ;
[640]809
[1286]810    /*! \brief Control variable and prototype for flow cover cut generator */
811    struct flowCtl_struct {
812        CGControl action_ ;
813        CglFlowCover *proto_ ;
814    } flow_ ;
[640]815
[1286]816    /*! \brief Control variable and prototype for Gomory cut generator */
817    struct gomoryCtl_struct {
818        CGControl action_ ;
819        CglGomory *proto_ ;
820        int limit_ ;
821        int limitAtRoot_ ;
822    } gomory_ ;
[640]823
[1286]824    /*   \brief Control variable and prototype for lift-and-project cut
825             generator
826       struct landpCtl_struct
827       { CGControl action_ ;
828         CglLandP *proto_ ; } landp_ ;
829    */
[640]830
[1286]831    /*! \brief Control variable and prototype for knapsack cover cut generator */
832    struct knapsackCtl_struct {
833        CGControl action_ ;
834        CglKnapsackCover *proto_ ;
835    } knapsack_ ;
[640]836
[1286]837    /*! \brief Control variable and prototype for MIR cut generator */
838    struct mirCtl_struct {
839        CGControl action_ ;
840        CglMixedIntegerRounding2 *proto_ ;
841    } mir_ ;
[640]842
[1286]843    /*! \brief Control variable and prototype for odd hole cut generator */
844    struct oddHoleCtl_struct {
845        CGControl action_ ;
846        CglOddHole *proto_ ;
847    } oddHole_ ;
[640]848
[1286]849    /*! \brief Control variable and prototype for reduce-and-split
850           cut generator
851    */
852    struct redSplitCtl_struct {
853        CGControl action_ ;
854        CglRedSplit *proto_ ;
855    } redSplit_ ;
[640]856
[1286]857    /*! \brief Control variable and prototype for Two-MIR cut generator */
858    struct twomirCtl_struct {
859        CGControl action_ ;
860        CglTwomir *proto_ ;
861        int maxElements_ ;
862    } twomir_ ;
[640]863
[1286]864    /*! \brief Control variable and prototype for feasibility pump heuristic */
865    struct fpumpCtl_struct {
866        CGControl action_ ;
867        CbcHeuristicFPump *proto_ ;
868        int iters_ ;
869    } fpump_ ;
[640]870
[1286]871    /*! \brief Control variable and prototype for combine heuristic */
872    struct combineCtl_struct {
873        CGControl action_ ;
874        CbcHeuristicLocal *proto_ ;
875        int trySwap_ ;
876    } combine_ ;
[640]877
[1286]878    /*! \brief Control variable and prototype for greedy cover heuristic */
879    struct greedyCoverCtl_struct {
880        CGControl action_ ;
881        CbcHeuristicGreedyCover *proto_ ;
882    } greedyCover_ ;
[640]883
[1286]884    /*! \brief Control variable and prototype for greedy equality heuristic */
885    struct greedyEqualityCtl_struct {
886        CGControl action_ ;
887        CbcHeuristicGreedyEquality *proto_ ;
888    } greedyEquality_ ;
[640]889
[1286]890    /*! \brief Control variable and prototype for simple rounding heuristic */
891    struct roundingCtl_struct {
892        CGControl action_ ;
893        CbcRounding *proto_ ;
894    } rounding_ ;
[640]895
896
[1286]897    /*! \brief Control variables for local tree
898
899      This is a bit different --- getTreeLocal() takes a CbcModel as a parameter
900      and installs a local tree object. But we can keep the parameters here and
901      hide the details. Consult CbcTreeLocal.hpp for details.
902    */
903    struct localTreeCtl_struct {
904        CGControl action_ ;
905        CbcTreeLocal *proto_ ;
906        double *soln_ ;
907        int range_ ;
908        int typeCuts_ ;
909        int maxDiverge_ ;
910        int timeLimit_ ;
911        int nodeLimit_ ;
912        bool refine_ ;
913    } localTree_ ;
914
[640]915//@}
916
[1286]917    /*! \name Messages and statistics (private)
918        \brief Data and objects related to messages and statistics that should be
919           protected from direct manipulation.
920    */
[640]921//@{
922
[1286]923    /*! \brief Message handler. */
924    CoinMessageHandler *msgHandler_ ;
[640]925
[1286]926    /*! \brief Ownership of message handler.
[640]927
[1286]928      If true, the control block owns the message handler and it will be destroyed
929      with the control block. If false, the client is responsible for the message
930      handler.
931    */
932    bool ourMsgHandler_ ;
[640]933
[1286]934    /*! \brief The current language */
935    CoinMessages::Language cur_lang_ ;
[640]936
[1286]937    /*! \brief The current set of messages. */
938    CoinMessages *msgs_ ;
[640]939
[1286]940    /*! \brief The current log level */
941    int logLvl_ ;
[640]942
943//@}
944
945} ;
946
947
948#endif
[1432]949
Note: See TracBrowser for help on using the repository browser.