source: trunk/Cbc/src/unitTestClp.cpp @ 1200

Last change on this file since 1200 was 1200, checked in by forrest, 10 years ago

get rid of compiler warnings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.2 KB
Line 
1/* $Id: unitTestClp.cpp 1200 2009-07-25 08:44:13Z forrest $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4
5#include <cstdio>
6#include <string>
7#include <iostream>
8
9#include "CoinTime.hpp"
10#include "CbcModel.hpp"
11#include "CbcCutGenerator.hpp"
12#include "CbcBranchCut.hpp"
13#include "CglProbing.hpp"
14#include "OsiClpSolverInterface.hpp"
15#include "ClpFactorization.hpp"
16#include "OsiRowCutDebugger.hpp"
17//#############################################################################
18
19#ifdef NDEBUG
20#undef NDEBUG
21#endif
22
23//#############################################################################
24
25// Display message on stdout and stderr
26void testingMessage( const char * const msg )
27{
28  std::cout <<msg;
29  //cout <<endl <<"*****************************************"
30  //     <<endl <<msg <<endl;
31}
32
33//#############################################################################
34
35static inline bool CbcTestFile(const std::string name)
36{
37  FILE *fp = fopen(name.c_str(),"r");
38  if (fp) {
39    fclose(fp);
40    return true;
41  }
42  return false;
43}
44
45//#############################################################################
46
47bool CbcTestMpsFile(std::string& fname)
48{
49  if (CbcTestFile(fname)) {
50    return true;
51  }
52  if (CbcTestFile(fname+".mps")) {
53    fname += ".mps";
54    return true;
55  }
56  if (CbcTestFile(fname+".MPS")) {
57    fname += ".MPS";
58    return true;
59  }
60#ifdef COIN_HAS_ZLIB
61  if (CbcTestFile(fname+".gz")) {
62    return true;
63  }
64  if (CbcTestFile(fname+".mps.gz")) {
65    fname += ".mps";
66    return true;
67  }
68  if (CbcTestFile(fname+".MPS.gz")) {
69    fname += ".MPS";
70    return true;
71  }
72  if (CbcTestFile(fname+".MPS.GZ")) {
73    fname += ".MPS";
74    return true;
75  }
76#endif
77  return false;
78}
79
80//#############################################################################
81
82int CbcClpUnitTest (const CbcModel & saveModel, std::string& dirMiplib,
83                    bool unitTestOnly,
84                    double * stuff)
85{
86  // Stop Windows popup
87  WindowsErrorPopupBlocker();
88  unsigned int m ;
89
90  // Set directory containing miplib data files.
91  std::string test1 = dirMiplib +"p0033";
92  // See if files exist
93  bool doTest=CbcTestMpsFile(test1);
94
95  if (!doTest) {
96    printf("Not doing miplib run as can't find mps files - ? .gz without libz\n");
97    return -1;
98  }
99  /*
100    Vectors to hold test problem names and characteristics. The objective value
101    after optimization (objValue) must agree to the specified tolerance
102    (objValueTol).
103  */
104  std::vector<std::string> mpsName ;
105  std::vector<int> nRows ;
106  std::vector<int> nCols ;
107  std::vector<double> objValueC ;
108  std::vector<double> objValue ;
109  std::vector<int> strategy ;
110  /*
111    And a macro to make the vector creation marginally readable.
112  */
113#define PUSH_MPS(zz_mpsName_zz,\
114                 zz_nRows_zz,zz_nCols_zz,zz_objValue_zz,zz_objValueC_zz, \
115                 zz_strategy_zz) \
116  mpsName.push_back(zz_mpsName_zz) ; \
117  nRows.push_back(zz_nRows_zz) ; \
118  nCols.push_back(zz_nCols_zz) ; \
119  objValueC.push_back(zz_objValueC_zz) ; \
120  strategy.push_back(zz_strategy_zz) ; \
121  objValue.push_back(zz_objValue_zz) ;
122
123  if (unitTestOnly) {
124    PUSH_MPS("p0033",16,33,3089,2520.57,7);
125    PUSH_MPS("p0201",133,201,7615,6875.0,7);
126  } else {
127    /*
128      Load up the problem vector. Note that the row counts here include the
129      objective function.
130    */
131    // 0 for no test, 1 for some, 2 for many, 3 for all
132    //PUSH_MPS("blend2",274,353,7.598985,6.9156751140,7);
133    //PUSH_MPS("p2756",755,2756,3124,2688.75,7);
134    //PUSH_MPS("seymour_1",4944,1372,410.7637014,404.35152,7);
135    //PUSH_MPS("enigma",21,100,0.0,0.0,7);
136    //PUSH_MPS("misc03",96,160,3360,1910.,7);
137    //PUSH_MPS("p0201",133,201,7615,6875.0,7);
138#define HOWMANY 2
139#if HOWMANY
140#if HOWMANY>1
141    PUSH_MPS("10teams",230,2025,924,917,7);
142#endif
143    PUSH_MPS("air03",124,10757,340160,338864.25,7);
144#if HOWMANY>2
145    PUSH_MPS("air04",823,8904,56137,55535.436,8);
146    PUSH_MPS("air05",426,7195,26374,25877.609,8);
147#endif
148  //    PUSH_MPS("arki001",1048,1388,7580813.0459,7579599.80787,7);
149    PUSH_MPS("bell3a",123,133,878430.32,862578.64,7);
150#if HOWMANY>1
151    PUSH_MPS("bell5",91,104,8966406.49,8608417.95,7);
152#endif
153    PUSH_MPS("blend2",274,353,7.598985,6.9156751140,7);
154#if HOWMANY>1
155    PUSH_MPS("cap6000",2176,6000,-2451377,-2451537.325,7);
156#endif
157    //    PUSH_MPS("dano3mip",3202,13873,728.1111,576.23162474,7);
158    //PUSH_MPS("danoint",664,521,65.67,62.637280418,7);
159    PUSH_MPS("dcmulti",290,548,188182,183975.5397,7);
160    PUSH_MPS("dsbmip",1182,1886,-305.19817501,-305.19817501,7);
161    PUSH_MPS("egout",98,141,568.101,149.589,7);
162    PUSH_MPS("enigma",21,100,0.0,0.0,7);
163#if HOWMANY>3
164    PUSH_MPS("fast0507",507,63009,174,172.14556668,7);
165#endif
166    PUSH_MPS("fiber",363,1298,405935.18000,156082.51759,7);
167#if HOWMANY>1
168    PUSH_MPS("fixnet6",478,878,3983,1200.88,7);
169#endif
170    PUSH_MPS("flugpl",18,18,1201500,1167185.7,7);
171    PUSH_MPS("gen",780,870,112313,112130.0,7);
172#if HOWMANY>1
173    PUSH_MPS("gesa2",1392,1224,25779856.372,25476489.678,7);
174    PUSH_MPS("gesa2_o",1248,1224,25779856.372,25476489.678,7);
175#endif
176    PUSH_MPS("gesa3",1368,1152,27991042.648,27833632.451,7);
177    PUSH_MPS("gesa3_o",1224,1152,27991042.648,27833632.451,7);
178    PUSH_MPS("gt2",29,188,21166.000,13460.233074,7);
179#if HOWMANY>2
180    PUSH_MPS("harp2",112,2993,-73899798.00,-74353341.502,7);
181#endif
182    PUSH_MPS("khb05250",101,1350,106940226,95919464.0,7);
183#if HOWMANY>1
184    PUSH_MPS("l152lav",97,1989,4722,4656.36,7);
185#endif
186    PUSH_MPS("lseu",28,89,1120,834.68,7);
187    PUSH_MPS("misc03",96,160,3360,1910.,7);
188    PUSH_MPS("misc06",820,1808,12850.8607,12841.6,7);
189#if HOWMANY>1
190    PUSH_MPS("misc07",212,260,2810,1415.0,7);
191    PUSH_MPS("mitre",2054,10724,115155,114740.5184,7);
192#endif
193    PUSH_MPS("mod008",6,319,307,290.9,7);
194    PUSH_MPS("mod010",146,2655,6548,6532.08,7);
195#if HOWMANY>2
196    PUSH_MPS("mod011",4480,10958,-54558535,-62121982.55,7);
197    PUSH_MPS("modglob",291,422,20740508,20430947.,7);
198#endif
199#if HOWMANY>3
200    PUSH_MPS("noswot",182,128,-43,-43.0,7);
201#endif
202#if HOWMANY>1
203    PUSH_MPS("nw04",36,87482,16862,16310.66667,7);
204#endif
205    PUSH_MPS("p0033",16,33,3089,2520.57,7);
206    PUSH_MPS("p0201",133,201,7615,6875.0,7);
207    PUSH_MPS("p0282",241,282,258411,176867.50,7);
208    PUSH_MPS("p0548",176,548,8691,315.29,7);
209    PUSH_MPS("p2756",755,2756,3124,2688.75,7);
210#if HOWMANY>2
211    PUSH_MPS("pk1",45,86,11.0,0.0,7);
212#endif
213#if HOWMANY>1
214    PUSH_MPS("pp08a",136,240,7350.0,2748.3452381,7);
215    PUSH_MPS("pp08aCUTS",246,240,7350.0,5480.6061563,7);
216#endif
217#if HOWMANY>2
218    PUSH_MPS("qiu",1192,840,-132.873137,-931.638857,7);
219#endif
220    PUSH_MPS("qnet1",503,1541,16029.692681,14274.102667,7);
221    PUSH_MPS("qnet1_o",456,1541,16029.692681,12095.571667,7);
222    PUSH_MPS("rentacar",6803,9557,30356761,28806137.644,7);
223    PUSH_MPS("rgn",24,180,82.1999,48.7999,7);
224#if HOWMANY>3
225    PUSH_MPS("rout",291,556,1077.56,981.86428571,7);
226    PUSH_MPS("set1ch",492,712,54537.75,32007.73,7);
227#endif
228    //    PUSH_MPS("seymour",4944,1372,423,403.84647413,7);
229    PUSH_MPS("stein27",118,27,18,13.0,7);
230#if HOWMANY>1
231    PUSH_MPS("stein45",331,45,30,22.0,7);
232#endif
233    PUSH_MPS("vpm1",234,378,20,15.4167,7);
234    PUSH_MPS("vpm2",234,378,13.75,9.8892645972,7);
235#endif
236  }
237#undef PUSH_MPS
238   
239  int numProbSolved = 0;
240  double timeTaken=0.0;
241  //#define CLP_FACTORIZATION_INSTRUMENT
242#ifdef CLP_FACTORIZATION_INSTRUMENT
243  double timeTakenFac=0.0;
244#endif
245  int numberFailures=0;
246 
247  /*
248    Open the main loop to step through the MPS problems.
249  */
250  for (m = 0 ; m < mpsName.size() ; m++) {
251    std::cout << "  processing mps file: " << mpsName[m] 
252              << " (" << m+1 << " out of " << mpsName.size() << ")\n";
253    /*
254      Stage 1: Read the MPS
255      and make sure the size of the constraint matrix is correct.
256    */
257    CbcModel * model = new CbcModel(saveModel);
258     
259    std::string fn = dirMiplib+mpsName[m] ;
260    if (!CbcTestMpsFile(fn)) {
261      std::cout << "ERROR: Cannot find MPS file " << fn << "\n";
262      continue;
263    }
264    CoinDrand48(true,1234567);
265    //printf("RAND1 %g %g\n",CoinDrand48(true,1234567),model->randomNumberGenerator()->randomDouble());
266    //printf("RAND1 %g\n",CoinDrand48(true,1234567));
267    model->solver()->readMps(fn.c_str(),"") ;
268    assert(model->getNumRows() == nRows[m]) ;
269    assert(model->getNumCols() == nCols[m]) ;
270
271    /*
272      Stage 2: Call solver to solve the problem.
273      then check the return code and objective.
274    */
275
276#ifdef CLP_FACTORIZATION_INSTRUMENT
277    extern double factorization_instrument(int type);
278    double facTime1=factorization_instrument(0);
279    printf("Factorization - initial solve %g seconds\n",
280           facTime1);
281    timeTakenFac += facTime1;
282#endif
283    double startTime = CoinCpuTime()+CoinCpuTimeJustChildren();
284    if (model->getMaximumNodes()>200000) {
285      model->setMaximumNodes(200000);
286    }
287    OsiClpSolverInterface * si =
288      dynamic_cast<OsiClpSolverInterface *>(model->solver()) ;
289    ClpSimplex * modelC = NULL;
290    if (si) {
291      // get clp itself
292      modelC = si->getModelPtr();
293      if (stuff&&stuff[9]) {
294        // vector matrix!
295        ClpMatrixBase * matrix = modelC->clpMatrix();
296        if (dynamic_cast< ClpPackedMatrix*>(matrix)) {
297          ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix);
298          clpMatrix->makeSpecialColumnCopy();
299        }
300      }
301      model->checkModel();
302      modelC->tightenPrimalBounds(0.0,0,true);
303      model->initialSolve();
304      if (modelC->dualBound()==1.0e10) {
305        // user did not set - so modify
306        // get largest scaled away from bound
307        ClpSimplex temp=*modelC;
308        temp.dual(0,7);
309        double largestScaled=1.0e-12;
310        double largest=1.0e-12;
311        int numberRows = temp.numberRows();
312        const double * rowPrimal = temp.primalRowSolution();
313        const double * rowLower = temp.rowLower();
314        const double * rowUpper = temp.rowUpper();
315        const double * rowScale = temp.rowScale();
316        int iRow;
317        for (iRow=0;iRow<numberRows;iRow++) {
318          double value = rowPrimal[iRow];
319          double above = value-rowLower[iRow];
320          double below = rowUpper[iRow]-value;
321          if (above<1.0e12) {
322            largest = CoinMax(largest,above);
323          }
324          if (below<1.0e12) {
325            largest = CoinMax(largest,below);
326          }
327          if (rowScale) {
328            double multiplier = rowScale[iRow];
329            above *= multiplier;
330            below *= multiplier;
331          }
332          if (above<1.0e12) {
333            largestScaled = CoinMax(largestScaled,above);
334          }
335          if (below<1.0e12) {
336            largestScaled = CoinMax(largestScaled,below);
337          }
338        }
339       
340        int numberColumns = temp.numberColumns();
341        const double * columnPrimal = temp.primalColumnSolution();
342        const double * columnLower = temp.columnLower();
343        const double * columnUpper = temp.columnUpper();
344        const double * columnScale = temp.columnScale();
345        int iColumn;
346        for (iColumn=0;iColumn<numberColumns;iColumn++) {
347          double value = columnPrimal[iColumn];
348          double above = value-columnLower[iColumn];
349          double below = columnUpper[iColumn]-value;
350          if (above<1.0e12) {
351            largest = CoinMax(largest,above);
352          }
353          if (below<1.0e12) {
354            largest = CoinMax(largest,below);
355          }
356          if (columnScale) {
357            double multiplier = 1.0/columnScale[iColumn];
358            above *= multiplier;
359            below *= multiplier;
360          }
361          if (above<1.0e12) {
362            largestScaled = CoinMax(largestScaled,above);
363          }
364          if (below<1.0e12) {
365            largestScaled = CoinMax(largestScaled,below);
366          }
367        }
368        std::cout<<"Largest (scaled) away from bound "<<largestScaled
369                 <<" unscaled "<<largest<<std::endl;
370#if 0
371        modelC->setDualBound(CoinMax(1.0001e8,
372                                     CoinMin(1000.0*largestScaled,1.00001e10)));
373#else
374        modelC->setDualBound(CoinMax(1.0001e9,
375                                     CoinMin(1000.0*largestScaled,1.0001e10)));
376#endif
377      }
378    }
379    model->setMinimumDrop(CoinMin(5.0e-2,
380                              fabs(model->getMinimizationObjValue())*1.0e-3+1.0e-4));
381    if (CoinAbs(model->getMaximumCutPassesAtRoot())<=100) {
382      if (model->getNumCols()<500) {
383        model->setMaximumCutPassesAtRoot(-100); // always do 100 if possible
384      } else if (model->getNumCols()<5000) {
385        model->setMaximumCutPassesAtRoot(100); // use minimum drop
386      } else {
387        model->setMaximumCutPassesAtRoot(20);
388      }
389    }
390    // If defaults then increase trust for small models
391    if (model->numberStrong()==5&&model->numberBeforeTrust()==10) {
392      int numberColumns = model->getNumCols();
393      if (numberColumns<=50) {
394        model->setNumberBeforeTrust(1000);
395      } else if (numberColumns<=100) {
396        model->setNumberBeforeTrust(100);
397      } else if (numberColumns<=300) {
398        model->setNumberBeforeTrust(50);
399      }
400    }
401    //if (model->getNumCols()>=500) {
402      // switch off Clp stuff
403      //model->setFastNodeDepth(-1);
404    //}
405    if (model->getNumCols()==-2756) {
406      // p2756
407      std::string problemName ;
408      model->solver()->getStrParam(OsiProbName,problemName) ;
409      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
410    }
411    if (model->getNumCols()==-201) {
412      // p201
413      std::string problemName ;
414      model->solver()->getStrParam(OsiProbName,problemName) ;
415      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
416    }
417    if (model->getNumCols()==-104) {
418      // bell5
419      std::string problemName ;
420      model->solver()->getStrParam(OsiProbName,problemName) ;
421      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
422    }
423    if (model->getNumCols()==-548&&model->getNumRows()==176) {
424      // p0548
425      std::string problemName ;
426      model->solver()->getStrParam(OsiProbName,problemName) ;
427      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
428    }
429    if (model->getNumCols()==-160) {
430      // misc03
431      std::string problemName ;
432      model->solver()->getStrParam(OsiProbName,problemName) ;
433      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
434    }
435    if (model->getNumCols()==-353) {
436      // blend2
437      std::string problemName ;
438      model->solver()->getStrParam(OsiProbName,problemName) ;
439      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
440    }
441    if (model->getNumCols()==-100&&model->getNumRows()==21) {
442      // enigma
443      std::string problemName ;
444      model->solver()->getStrParam(OsiProbName,problemName) ;
445      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
446    }
447    if (model->getNumCols()==-1541) {
448      // qnet1
449      std::string problemName ;
450      model->solver()->getStrParam(OsiProbName,problemName) ;
451      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
452    }
453    if (model->getNumCols()==-10724) {
454      // mitre
455      std::string problemName ;
456      model->solver()->getStrParam(OsiProbName,problemName) ;
457      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
458    }
459    if (model->getNumCols()==-1224) {
460      //PUSH_MPS("gesa2",1392,1224,25779856.372,25476489.678,7);
461      // gesa2
462      std::string problemName ;
463      model->solver()->getStrParam(OsiProbName,problemName) ;
464      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
465    }
466    if (model->getNumCols()==-1152) {
467      //PUSH_MPS("gesa3",1368,1152,27991042.648,27833632.451,7);
468      // gesa3
469      std::string problemName ;
470      model->solver()->getStrParam(OsiProbName,problemName) ;
471      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
472    }
473    if (model->getNumCols()==-282) {
474      //PUSH_MPS("p0282",241,282,258411,176867.50,7);
475      // p0282
476      std::string problemName ;
477      model->solver()->getStrParam(OsiProbName,problemName) ;
478      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
479    }
480    if (model->getNumCols()==-141) {
481      // egout
482      std::string problemName ;
483      model->solver()->getStrParam(OsiProbName,problemName) ;
484      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
485    }
486    if (model->getNumCols()==-378) {
487      // vpm2
488      std::string problemName ;
489      model->solver()->getStrParam(OsiProbName,problemName) ;
490      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
491    }
492    if (model->getNumCols()==-240&&model->getNumRows()==246) {
493      // pp08aCUTS
494      std::string problemName ;
495      model->solver()->getStrParam(OsiProbName,problemName) ;
496      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
497    }
498    if (model->getNumCols()==-240&&model->getNumRows()==136) {
499      // pp08a
500      std::string problemName ;
501      model->solver()->getStrParam(OsiProbName,problemName) ;
502      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
503    }
504    if (model->getNumCols()==-1372&&model->getNumRows()==4944) {
505      // seymour1
506      std::string problemName ;
507      model->solver()->getStrParam(OsiProbName,problemName) ;
508      model->solver()->activateRowCutDebugger(problemName.c_str()) ;
509    }
510    setCutAndHeuristicOptions(*model);
511    if (si) {
512#ifdef CLP_MULTIPLE_FACTORIZATIONS
513      if (!modelC->factorization()->isDenseOrSmall()) {
514        int denseCode = stuff ? static_cast<int> (stuff[4]) : -1;
515        int smallCode = stuff ? static_cast<int> (stuff[10]) : -1;
516        if (stuff&&stuff[8]>=1) {
517          if (denseCode<0)
518            denseCode=40;
519          if (smallCode<0)
520            smallCode=40;
521        }
522        if (denseCode>0)
523          modelC->factorization()->setGoDenseThreshold(denseCode);
524        if (smallCode>0)
525          modelC->factorization()->setGoSmallThreshold(smallCode);
526        if (denseCode>=modelC->numberRows()) {
527          //printf("problem going dense\n");
528          //modelC->factorization()->goDenseOrSmall(modelC->numberRows());
529        }
530      }
531#endif
532      if (stuff&&stuff[8]>=1) {
533        if (modelC->numberColumns()+modelC->numberRows()<=100000&&
534            model->fastNodeDepth()==-1) 
535          model->setFastNodeDepth(-9);
536      }
537    }
538    //OsiObject * obj = new CbcBranchToFixLots(model,0.3,0.0,3,3000003);
539    //model->addObjects(1,&obj);
540    //delete obj;
541    model->branchAndBound();
542#ifdef CLP_FACTORIZATION_INSTRUMENT
543    double facTime=factorization_instrument(0);
544    printf("Factorization %g seconds\n",
545           facTime);
546    timeTakenFac += facTime;
547#endif
548     
549    double timeOfSolution = CoinCpuTime()+CoinCpuTimeJustChildren()-startTime;
550    // Print more statistics
551    std::cout<<"Cuts at root node changed objective from "<<model->getContinuousObjective()
552             <<" to "<<model->rootObjectiveAfterCuts()<<std::endl;
553    int numberGenerators = model->numberCutGenerators();
554    for (int iGenerator=0;iGenerator<numberGenerators;iGenerator++) {
555      CbcCutGenerator * generator = model->cutGenerator(iGenerator);
556#ifndef CLP_INVESTIGATE
557      CglImplication * implication = dynamic_cast<CglImplication*>(generator->generator());
558      if (implication)
559        continue;
560#endif
561      std::cout<<generator->cutGeneratorName()<<" was tried "
562               <<generator->numberTimesEntered()<<" times and created "
563               <<generator->numberCutsInTotal()<<" cuts of which "
564               <<generator->numberCutsActive()<<" were active after adding rounds of cuts";
565      if (generator->timing())
566        std::cout<<" ( "<<generator->timeInCutGenerator()<<" seconds)"<<std::endl;
567      else
568        std::cout<<std::endl;
569    }
570    if (!model->status()) { 
571      double soln = model->getObjValue(); 
572      double tolerance = CoinMax(1.0e-5,1.0e-5*CoinMin(fabs(soln),fabs(objValue[m])));
573      //CoinRelFltEq eq(1.0e-3) ;
574      if (fabs(soln-objValue[m])<tolerance) { 
575        std::cout
576          <<"cbc_clp"<<" "
577          << soln << " = " << objValue[m] << " ; okay";
578        numProbSolved++;
579      } else  { 
580        std::cout <<"cbc_clp" <<" " <<soln << " != " <<objValue[m]
581                  << "; error=" << fabs(objValue[m] - soln); 
582        numberFailures++;
583        //#ifdef COIN_DEVELOP
584        //abort();
585        //#endif
586      }
587    } else {
588      std::cout << "error; too many nodes" ;
589    }
590    timeTaken += timeOfSolution;
591    std::cout<<" - took " <<timeOfSolution<<" seconds.("<<
592      model->getNodeCount()<<" / "<<model->getIterationCount()<<
593      " ) subtotal "<<timeTaken<<std::endl;
594    delete model;
595  }
596  int returnCode=0;
597  std::cout
598    <<"cbc_clp" 
599    <<" solved " 
600    <<numProbSolved
601    <<" out of "
602    <<objValue.size();
603  int numberOnNodes = objValue.size()-numProbSolved-numberFailures;
604  if (numberFailures||numberOnNodes) {
605    if (numberOnNodes) {
606      std::cout<<" ("<<numberOnNodes<<" stopped on nodes)";
607      returnCode = numberOnNodes;
608    }
609    if (numberFailures) {
610      std::cout<<" ("<<numberFailures<<" gave bad answer!)";
611      returnCode += 100*numberFailures;
612    }
613  }
614  std::cout<<" and took "
615    <<timeTaken
616    <<" seconds."
617    <<std::endl;
618  if (unitTestOnly) {
619    if(numberFailures||numberOnNodes) {
620      printf("****** Unit Test failed\n");
621      fprintf(stderr,"****** Unit Test failed\n");
622    } else {
623      fprintf(stderr,"Unit Test succeeded\n");
624    }
625  }
626#ifdef CLP_FACTORIZATION_INSTRUMENT
627  printf("Total factorization time %g seconds\n",
628         timeTakenFac);
629#endif
630  return returnCode;
631}
Note: See TracBrowser for help on using the repository browser.