Changeset 2216
 Timestamp:
 Feb 22, 2019 7:01:42 PM (20 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp
r2208 r2216 4003 4003 OSIUNITTEST_ASSERT_ERROR(eq(objCoef[7], 1.0), {}, *exmip1Si, "problem read correctly: objective coefficients"); 4004 4004 4005 // make sure col solution is something reasonable,4006 // that is between upper and lower bounds4007 const double *cs = exmip1Si>getColSolution();4008 int c;4009 bool okColSol = true;4010 //double inf = exmip1Si>getInfinity();4011 for (c = 0; c < nc; c++) {4012 // if colSol is not between column bounds then4013 // colSol is unreasonable.4014 if (!(cl[c] <= cs[c] && cs[c] <= cu[c]))4015 okColSol = false;4016 // if at least one column bound is not infinite,4017 // then it is unreasonable to have colSol as infinite4018 // FIXME: temporarily commented out pending some group thought on the4019 // semantics of this test.  lh, 03.04.29 4020 // if ( (cl[c]<inf  cu[c]<inf) && cs[c]>=inf ) okColSol=false;4021 }4022 OSIUNITTEST_ASSERT_WARNING(okColSol, {}, *exmip1Si, "column solution before solve");4023 4024 // Test that objective value is correct4025 // FIXME: the test checks the primal value. vol fails this, because vol4026 // considers the dual value to be the objective value4027 /*4028 gurobi fails this, because gurobi does not have a solution before a4029 model is solved (which makes sense, I (SV) think)4030 4031 Eh, well, you can argue the point, but the current OSI spec requires4032 that there be a valid solution from the point that the problem is4033 loaded. Nothing says it needs to be a good solution.  lh, 100826 4034 */4035 double correctObjValue = CoinPackedVector(nc, objCoef).dotProduct(cs);4036 double siObjValue = exmip1Si>getObjValue();4037 OSIUNITTEST_ASSERT_SEVERITY_EXPECTED(eq(correctObjValue, siObjValue), {}, *exmip1Si, "solution value before solve", TestOutcome::WARNING, solverName == "Vol");4038 4005 } 4039 4006 … … 4142 4109 OSIUNITTEST_ASSERT_ERROR(eq(ru[4], 15.), {}, solverName, "problem cloned: rows upper bounds"); 4143 4110 4144 const double *objCoef = exmip1Si>getObjCoefficients();4111 const double *objCoef = si2>getObjCoefficients(); 4145 4112 OSIUNITTEST_ASSERT_ERROR(eq(objCoef[0], 1.0), {}, solverName, "problem cloned: objective coefficients"); 4146 4113 OSIUNITTEST_ASSERT_ERROR(eq(objCoef[1], 0.0), {}, solverName, "problem cloned: objective coefficients"); … … 4151 4118 OSIUNITTEST_ASSERT_ERROR(eq(objCoef[6], 0.0), {}, solverName, "problem cloned: objective coefficients"); 4152 4119 OSIUNITTEST_ASSERT_ERROR(eq(objCoef[7], 1.0), {}, solverName, "problem cloned: objective coefficients"); 4153 4154 // make sure col solution is something reasonable,4155 // that is between upper and lower bounds4156 const double *cs = exmip1Si>getColSolution();4157 int c;4158 bool okColSol = true;4159 //double inf = exmip1Si>getInfinity();4160 for (c = 0; c < nc; c++) {4161 // if colSol is not between column bounds then4162 // colSol is unreasonable.4163 if (!(cl[c] <= cs[c] && cs[c] <= cu[c]))4164 okColSol = false;4165 // if at least one column bound is not infinite,4166 // then it is unreasonable to have colSol as infinite4167 // FIXME: temporarily commented out pending some group thought on the4168 // semantics of this test.  lh, 03.04.29 4169 // if ( (cl[c]<inf  cu[c]<inf) && cs[c]>=inf ) okColSol=false;4170 }4171 OSIUNITTEST_ASSERT_WARNING(okColSol, {}, solverName, "problem cloned: column solution before solve");4172 4120 4173 4121 // Test getting of objective offset
Note: See TracChangeset
for help on using the changeset viewer.