Changeset 814 for stable/0.4


Ignore:
Timestamp:
Feb 4, 2012 8:46:39 AM (8 years ago)
Author:
pbelotti
Message:

fix segfault in OS by checking getRecordBestSol() is non-NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/0.4/Couenne/src/main/CouenneBab.cpp

    r795 r814  
    676676  }
    677677
    678   s.nonlinearSolver()->model()->finalize_solution(status,
    679                                                   s.nonlinearSolver()->getNumCols(),
    680                                                   problem_ -> getRecordBestSol () -> getSol (),
    681                                                   problem_ -> getRecordBestSol () -> getVal ());
     678  // Which solution should we use? false if RBS's, true if Cbc's
     679  bool use_RBS_Cbc =
     680    !(problem_ -> getRecordBestSol ()) ||
     681    (((fabs (bestObj_) < COUENNE_INFINITY / 1e4) &&
     682      (problem_ -> getRecordBestSol () -> getVal () > bestObj_)));
     683
     684  s.nonlinearSolver () -> model () -> finalize_solution
     685    (status,
     686     s.nonlinearSolver () -> getNumCols (),
     687     use_RBS_Cbc ? bestSolution_ : problem_ -> getRecordBestSol () -> getSol (),
     688     use_RBS_Cbc ? bestObj_      : problem_ -> getRecordBestSol () -> getVal ());
    682689}
    683690
Note: See TracChangeset for help on using the changeset viewer.