Changeset 2052 for trunk/Cbc/test/CInterfaceTest.c
- Timestamp:
- Jul 27, 2014 2:56:51 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/test/CInterfaceTest.c
r2047 r2052 325 325 } 326 326 327 void testIntegerBounds() { 328 /* max 1.1x + 100.0z 329 st x + z <= 3 330 0 <= x <= 3 331 0 <= z <= 1.5, Integer 332 x* = 2, z* = 1 */ 333 334 Cbc_Model *model = Cbc_newModel(); 335 336 CoinBigIndex start[] = {0,1,2}; 337 int rowindex[] = {0, 0}; 338 double value[] = {1, 1}; 339 double rowlb[] = {-INFINITY}; 340 double rowub[] = {3.0}; 341 double collb[] = {0.0, 0.0}; 342 double colub[] = {3.0, 1.5}; 343 double obj[] = {1.1,100.0}; 344 const double *sol; 345 346 Cbc_loadProblem(model, 2, 1, start, rowindex, value, collb, colub, obj, rowlb, rowub); 347 348 Cbc_setInteger(model, 1); 349 Cbc_setObjSense(model, -1); 350 351 Cbc_solve(model); 352 353 assert(Cbc_isProvenOptimal(model)); 354 355 sol = Cbc_getColSolution(model); 356 357 assert(fabs(sol[0] - 2.0) < 1e-6); 358 assert(fabs(sol[1] - 1.0) < 1e-6); 359 360 Cbc_deleteModel(model); 361 362 } 363 327 364 328 365 int main() { … … 338 375 /*printf("Problem modification test\n"); 339 376 testProblemModification();*/ 377 printf("Integer bounds test\n"); 378 testIntegerBounds(); 340 379 341 380 return 0;
Note: See TracChangeset
for help on using the changeset viewer.