Changeset 11


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

Location:
trunk
Files:
18 deleted
5 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
  • trunk/Couenne/src/main/BonCouenneSetup.cpp

    r1 r11  
    440440    CouenneCutGenerator::registerOptions (roptions);
    441441    CouenneDisjCuts::registerOptions (roptions);
     442
     443    roptions -> AddNumberOption
     444      ("couenne_check",
     445       "known value of a global optimum",
     446       COIN_DBL_MAX,
     447       "Default value is +infinity.");
    442448
    443449    roptions -> AddStringOption2 (
  • trunk/Couenne/test/couenne.opt.base

    r1 r11  
     1time_limit 20
     2node_limit 1000
  • trunk/Couenne/test/grandTest.sh.in

    r1 r11  
    1616    echo " " Testing $method
    1717
     18    cat $srcdir/../test/couenne.opt.base $i  > couenne.opt
     19    echo -n "couenne_check "                >> couenne.opt
     20    cat $srcdir/../test/data/$name.obj      >> couenne.opt
     21
    1822    for j in $srcdir/../test/data/*.nl
    19 
    2023    do
    21         cat $srcdir/../test/couenne.opt.base $i > couenne.opt
    22 
    23         result=`../src/main/couenne $j | grep Stats | awk '{printf ("%20e\n", $21);}'`
    24         name=`basename $j .nl`
    25         val=`cat $srcdir/../test/data/$name.obj`
    26    
    27         rm couenne.opt
    28 
    29         [ $result == $val ] && printf "    Test for %-20s on %-20s OK\n" $method $name
    30         [ $result == $val ] || (printf "    Test for %-20s on %-20s FAILED: %s != %s\n" \
    31                                  $method $name $result $val && success=0)
     24        ../src/main/couenne $j
    3225    done
    3326 
     27    rm couenne.opt
    3428    echo
    3529
  • trunk/INSTALL

    r8 r11  
    9191
    9292If all these tests return OK, congratulations! You have set up Couenne
    93 correctly.  It is safe now to install Couenne.
     93correctly.  It is now safe to install Couenne.
    9494
    9595
Note: See TracChangeset for help on using the changeset viewer.