Ignore:
Timestamp:
Nov 3, 2008 10:35:09 PM (12 years ago)
Author:
pbelotti
Message:

removed old data files for check, updated INSTALL file. Added new check option/mode

File:
1 edited

Legend:

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

    r1 r11  
    7474    std::cout.precision (10);
    7575
    76     /*std::string message, status;
     76    //////////////////////////////
     77    CouenneCutGenerator *cg = NULL;
    7778
    78     if(bb.mipStatus()==Bab::FeasibleOptimal) {
    79       status = "\t\"Finished\"";
    80       message = "\nbonmin: Optimal";
    81     }
    82     else if(bb.mipStatus()==Bab::ProvenInfeasible) {
    83       status = "\t\"Finished\"";
    84       message = "\nbonmin: Infeasible problem";
    85     }
    86     else if(bb.mipStatus()==Bab::Feasible) {
    87       status = "\t\"Not finished\"";
    88       message = "\n Optimization not finished.";
    89     }
    90     else if(bb.mipStatus()==Bab::NoSolutionKnown) {
    91       status = "\t\"Not finished\"";
    92       message = "\n Optimization not finished.";
    93       }*/
     79    if (bb.model (). cutGenerators ())
     80      cg = dynamic_cast <CouenneCutGenerator *>
     81        (bb.model (). cutGenerators () [0] -> generator ());
     82
     83    if (cg) cg -> getStats (nr, nt, st);
     84    else printf ("Warning, could not get pointer to CouenneCutGenerator\n");
     85
     86    CouenneProblem *cp = cg ? cg -> Problem () : NULL;
     87
     88    // retrieve test value to check
     89    double global_opt;
     90    bonmin.options () -> GetNumericValue ("couenne_check", global_opt, "couenne.");
     91
     92    if (global_opt < COUENNE_INFINITY) { // some value found in couenne.opt
     93
     94      double opt = bb.model (). getBestPossibleObjValue ();
     95
     96      printf ("Test on %-40s: %s\n", cp ? cp -> problemName ().c_str () : "unknown",
     97              (fabs (opt - global_opt) /
     98               (1. + CoinMax (fabs (opt), fabs (global_opt))) < COUENNE_EPS) ?
     99              (char *) "OK", (char *) "FAILED");
     100
     101    } else // good old statistics
    94102
    95103    if (bonmin.displayStats ()) { // print statistics
     
    100108
    101109      // CAUTION: assuming first cut generator is our CouenneCutGenerator
    102 
    103       CouenneCutGenerator *cg = NULL;
    104 
    105       if (bb.model (). cutGenerators ())
    106         cg = dynamic_cast <CouenneCutGenerator *>
    107           (bb.model (). cutGenerators () [0] -> generator ());
    108 
    109       if (cg) cg -> getStats (nr, nt, st);
    110       else printf ("Warning, could not get pointer to CouenneCutGenerator\n");
    111 
    112       CouenneProblem *cp = cg ? cg -> Problem () : NULL;
    113110
    114111      if (cg && !cp) printf ("Warning, could not get pointer to problem\n");
     
    133130                //bb.iterationCount ());
    134131                //status.c_str (), message.c_str ());
    135 
    136       /*
    137       /////////////////////////////////
    138 
    139       double timeLimit = 0, obj = bb.model (). getObjValue ();
    140       bonmin.options() -> GetNumericValue ("time_limit", timeLimit, "bonmin.");
    141 
    142       if (CoinCpuTime () - time_start > timeLimit) {
    143 
    144         // time limit reached, print upper and (in brackets) lower
    145 
    146         double obj = bb.model (). getObjValue ();
    147 
    148         if (fabs (obj) < 9e12)
    149           printf    ("%18.9f &", bb.bestObj ());
    150         else printf (" %8s     &", "inf_prim");
    151 
    152         if (fabs (bb.bestBound()) < 9e12)
    153           printf    (" (%18.9f) &", bb.bestBound ());
    154         else printf (" %8s       &", "inf_dual");
    155       }
    156       else {
    157         // time limit not reached, print upper and time
    158 
    159         if (fabs (obj) < 9e12)
    160           printf    (" %18.9f &", bb.bestObj ());
    161         else printf (" %8s     &", "inf_prim");
    162          
    163         if (fabs (bb.bestBound()) < 9e12)
    164           printf    (" %12.3f   &", CoinCpuTime () - time_start);
    165         else printf (" %8s       &", "inf_dual");
    166       }
    167 
    168 
    169       printf ("%7d & %7d \\\\\n",
    170               bb.numNodes(),
    171               bb.iterationCount());
    172               //              nlp_and_solver->totalNlpSolveTime(),
    173               //              nlp_and_solver->nCallOptimizeTNLP(),
    174       //              status.c_str());
    175       */
    176132    }
    177133
Note: See TracChangeset for help on using the changeset viewer.