Ignore:
Timestamp:
May 30, 2011 12:47:59 PM (9 years ago)
Author:
pbelotti
Message:

BonCouenne?.cpp: stabilizing pointers for PrintInfo?() added by Francois, removing warnings. Merging Recorded Best Sol data from art_cutoff option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/main/BonCouenne.cpp

    r586 r587  
    1111// Date : 12/19/2006
    1212
    13 
    1413#if defined(_MSC_VER)
    1514// Turn off compiler warning about long names
    1615#  pragma warning(disable:4786)
    1716#endif
     17
    1818#include <iomanip>
    1919#include <fstream>
     
    4949
    5050#ifdef COIN_HAS_NTY
    51 int nOrbBr = 0;
     51int nOrbBr = 0; // FIXME: horrible global variable. Brrr.
    5252#endif
    5353
     
    118118      throw infeasible;
    119119
    120 #ifdef FM_PRINT_INFO
     120    //////////////////////////////
     121    CouenneCutGenerator *cg = NULL;
     122
     123    // there is only one CouenneCutGenerator object; scan array until
     124    // dynamic_cast returns non-NULL
     125
     126    if (couenne. cutGenerators () . size () > 0) {
     127
     128      for (std::list <Bonmin::BabSetupBase::CuttingMethod>::iterator
     129                   i  = couenne.cutGenerators () . begin ();
     130           !cg && (i != couenne.cutGenerators () . end ());
     131           ++i)
     132
     133        cg = dynamic_cast <CouenneCutGenerator *> (i -> cgl);
     134    }
     135
    121136    // This assumes that first cut generator is CouenneCutGenerator
    122     CouenneCutGenerator *ccg = dynamic_cast<CouenneCutGenerator *>
    123       (couenne.cutGenerators().begin()->cgl);
    124     if(ccg) {
    125       ccg->setBabPtr(&bb);
    126     }
     137    // CouenneCutGenerator *cg = dynamic_cast<CouenneCutGenerator *>
     138    //   (couenne.cutGenerators().begin()->cgl);
     139
     140    if (cg)
     141
     142      cg -> setBabPtr (&bb);
     143
    127144    else {
    128       printf("main(): ### ERROR: Can not get CouenneCutGenerator\n");
    129       exit(1);
    130     }
    131 #endif
     145      printf ("main(): ### ERROR: Can not get CouenneCutGenerator\n");
     146      exit (1);
     147    }
    132148
    133149    // initial printout
     
    177193    std::cout.precision (10);
    178194
    179     //////////////////////////////
    180     CouenneCutGenerator *cg = NULL;
    181 
    182     // there is only one cut generator, so scan array until
    183     // dynamic_cast returns non-NULL
    184 
    185     if (bb.model (). cutGenerators ()) {
    186 
    187       int nGen = bb.model (). numberCutGenerators ();
    188      
    189       for (int i=0; !cg && i < nGen; i++)
    190         cg = dynamic_cast <CouenneCutGenerator *>
    191           (bb.model (). cutGenerators () [i] -> generator ());
    192     }
    193 
    194195    ////////////////////////////////
    195196    int nr=-1, nt=-1;
     
    201202    CouenneProblem *cp = cg ? cg -> Problem () : NULL;
    202203
     204#if defined (FM_TRACE_OPTSOL) || defined (FM_FRES)
    203205    double cbcLb = bb.model ().getBestPossibleObjValue();
    204206    double printObj = 0;
    205207    bool foundSol = false;
     208#endif
    206209
    207210#ifdef FM_TRACE_OPTSOL
    208211
    209     FILE *fSol = fopen("bidon.sol", "w");
     212    FILE *fSol = fopen ("bidon.sol", "w");
     213
    210214    if(fSol == NULL) {
    211215      printf("### ERROR: can not open bidon.sol\n");
     
    369373
    370374    if (couenne.displayStats ()) { // print statistics
    371 
    372       // CAUTION: assuming first cut generator is our CouenneCutGenerator
    373375
    374376      if (cg && !cp) printf ("Warning, could not get pointer to problem\n");
Note: See TracChangeset for help on using the changeset viewer.