Changeset 981 for trunk


Ignore:
Timestamp:
Jul 28, 2013 7:49:20 AM (6 years ago)
Author:
fmargot
Message:

Fix crash when using C and no feasible solution found yet

File:
1 edited

Legend:

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

    r966 r981  
    355355      }
    356356     
    357       fprintf(f_res, "%20s %10.4f", shortName, cbcLb);
     357
     358      fprintf(f_res, "%20s ", shortName);
     359      if((cbcLb > 1e20) || (cbcLb < -1e20)) {
     360        fprintf(f_res, "%10.4g", cbcLb);
     361      }
     362      else {
     363        fprintf(f_res, "%10.4f", cbcLb);
     364      }
    358365      if(foundSol) {
    359366        fprintf(f_res, " %10.4f", printObj);
     
    396403    sprintf (lbstr,  "%10g",     lb);
    397404    sprintf (ubstr,  "%10g",     ub);
    398     sprintf (gapstr, "%.2f%%", fabs (100. * (ub - lb) / (1. + fabs (lb))));
     405    if(ub > COUENNE_INFINITY/1e4) {
     406      sprintf (gapstr, "--");
     407    }
     408    else {
     409      sprintf (gapstr, "%.2f%%", fabs (100. * (ub - lb) / (1. + fabs (lb))));
     410    }
    399411
    400412    if (!infeasible)
Note: See TracChangeset for help on using the changeset viewer.