Changeset 3030
 Timestamp:
 May 2, 2020 12:47:31 PM (2 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/Cbc_C_Interface.cpp
r3029 r3030 239 239 #endif 240 240 241 double obj_value; 241 242 242 243 int nSos; … … 1036 1037 model>solver_ = new OsiClpSolverInterface(); 1037 1038 model>relax_ = 0; 1039 model>obj_value = COIN_DBL_MAX; 1038 1040 1039 1041 model>cbcModel_ = NULL; … … 1777 1779 solver>initialSolve(); 1778 1780 1779 if (solver>isProvenOptimal()) 1781 if (solver>isProvenOptimal()) { 1782 model>obj_value = solver>getObjValue(); 1780 1783 return 0; 1781 if (solver>isIterationLimitReached()) 1784 } 1785 if (solver>isIterationLimitReached()) { 1786 model>obj_value = solver>getObjValue(); 1782 1787 return 1; 1788 } 1783 1789 if (solver>isProvenDualInfeasible()) 1784 1790 return 3; … … 1793 1799 { 1794 1800 CoinMessages generalMessages = model>solver_>getModelPtr()>messages(); 1801 1802 model>obj_value = COIN_DBL_MAX; 1795 1803 1796 1804 int res = Cbc_solveLinearProgram(model); … … 1805 1813 solver>isAbandoned()  solver>isIterationLimitReached()  model>relax_ == 1 1806 1814  solver>getNumIntegers() == 0) { 1815 if (solver>isProvenOptimal()  solver>isIterationLimitReached()) { 1816 model>obj_value = solver>getObjValue(); 1817 } 1807 1818 return 0; 1808 1819 } … … 1977 1988 memcpy(model>lastOptMIPSol, cbcModel>bestSolution(), sizeof(double)*Cbc_getNumCols(model) ); 1978 1989 model>lastOptNCols = Cbc_getNumCols(model); 1990 1991 model>obj_value = cbcModel>getObjValue(); 1992 1993 if (cbcModel>getObjSense()==1) { 1994 model>obj_value = 0.0; 1995 1996 for (int j=0 ; j<solver>getNumCols() ; ++j ) 1997 model>obj_value += cbcModel>bestSolution()[j] * solver>getObjCoefficients()[j]; 1998 } // circunvent CBC bug 1979 1999 } 1980 2000 … … 2240 2260 Cbc_getObjValue(Cbc_Model *model) 2241 2261 { 2242 switch (model>lastOptimization) { 2243 case ModelNotOptimized: 2244 fprintf( stderr, "Information not available, model was not optimized yet.\n"); 2245 abort(); 2246 break; 2247 case ContinuousOptimization: 2248 return model>solver_>getObjValue(); 2249 case IntegerOptimization: 2250 return model>cbcModel_>getObjValue(); 2251 } 2252 2253 return COIN_DBL_MAX; 2262 return model>obj_value; 2254 2263 } 2255 2264 … … 2879 2888 result>cutCBhowOften = model>cutCBhowOften; 2880 2889 result>cutCBAtSol = model>cutCBAtSol; 2890 2891 result>obj_value = model>obj_value; 2881 2892 2882 2893
Note: See TracChangeset
for help on using the changeset viewer.