Changeset 696 for trunk/Cbc


Ignore:
Timestamp:
Jul 19, 2007 4:00:04 PM (13 years ago)
Author:
forrest
Message:

make easier to call standalone solver code

Location:
trunk/Cbc/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcLinked.cpp

    r692 r696  
    58095809  // If we move to xy then we move by coefficient * (xyTrue-xyLambda) on row xyRow_
    58105810  double movement = xyTrue-xyLambda;
     5811  double mesh=CoinMax(xMeshSize_,yMeshSize_);
     5812  if (fabs(movement)<xySatisfied_&&(xB[1]-xB[0])<mesh||yB[1]-yB[0]<mesh)
     5813    return 0.0; // say feasible
    58115814  const double * activity = info->rowActivity_;
    58125815  const double * lower = info->rowLower_;
  • trunk/Cbc/src/CbcModel.cpp

    r695 r696  
    36653665  delete tree_;
    36663666  tree_=NULL;
    3667   if (ourSolver_) delete solver_;
     3667  if (ourSolver_) {
     3668    delete solver_;
     3669    solver_ = NULL;
     3670  }
    36683671  gutsOfDestructor();
    36693672  delete eventHandler_ ;
     
    37223725  numberIntegers_=0;
    37233726  numberObjects_=0;
     3727  // Below here is whatever consensus is
     3728  ourSolver_=true;
     3729  delete branchingMethod_;
     3730  branchingMethod_=NULL;
     3731  delete cutModifier_;
     3732  cutModifier_=NULL;
     3733  resetModel();
     3734}
     3735// Clears out enough to reset CbcModel
     3736void
     3737CbcModel::resetModel()
     3738{
    37243739  delete emptyWarmStart_ ;
    37253740  emptyWarmStart_ =NULL;
     
    37453760  delete [] whichGenerator_;
    37463761  whichGenerator_ = NULL;
    3747   for (i=0;i<maximumStatistics_;i++)
     3762  for (int i=0;i<maximumStatistics_;i++)
    37483763    delete statistics_[i];
    37493764  delete [] statistics_;
     
    37563771  delete [] analyzeResults_;
    37573772  analyzeResults_=NULL;
    3758   // Below here is whatever consensus is
    3759   ourSolver_=true;
    37603773  bestObjective_=COIN_DBL_MAX;
    37613774  bestPossibleObjective_=COIN_DBL_MAX;
     
    37803793  nextRowCut_=NULL;
    37813794  currentNode_=NULL;
    3782   delete branchingMethod_;
    3783   branchingMethod_=NULL;
    3784   delete cutModifier_;
    3785   cutModifier_=NULL;
    37863795  // clear out tree
    37873796  if (tree_&&tree_->size())
     
    38043813  numberStrongIterations_=0;
    38053814  // Parameters which need to be reset
     3815  setCutoff(COIN_DBL_MAX);
    38063816  dblParam_[CbcCutoffIncrement] = 1e-5;
    38073817  dblParam_[CbcCurrentCutoff] = 1.0e100;
     
    44954505      addUpdateInformation(update);
    44964506    } else {
    4497       OsiTwoWayBranchingObject * obj = dynamic_cast<OsiTwoWayBranchingObject *> (bobj);
     4507      OsiIntegerBranchingObject * obj = dynamic_cast<OsiIntegerBranchingObject *> (bobj);
    44984508      if (obj) {
    44994509        const OsiObject * object = obj->originalObject();
     
    65006510  delete [] type;
    65016511  delete [] lookup;
     6512#ifdef COIN_DEVELOP
    65026513  if (numberCliques<0) {
    65036514    printf("*** Problem infeasible\n");
     
    65166527      printf("%d variables fixed\n",numberFixed);
    65176528  }
     6529#endif
    65186530  if (numberCliques>0&&numberSlacks&&makeEquality) {
    65196531    printf("adding %d integer slacks\n",numberSlacks);
     
    69516963  delete [] integerVariable_;
    69526964  integerVariable_=NULL;
     6965#ifdef COIN_DEVELOP
    69536966  if (newIntegers!=numberIntegers_)
    69546967    printf("changing number of integers from %d to %d\n",
    69556968           numberIntegers_,newIntegers);
     6969#endif
    69566970  numberIntegers_ = newIntegers;
    69576971  integerVariable_ = new int [numberIntegers_];
     
    69766990    }
    69776991  }
     6992#ifdef COIN_DEVELOP
    69786993  if (newIntegers)
    69796994    printf("%d variables were declared integer\n",newIntegers);
     6995#endif
    69806996  int n=numberIntegers_;
    69816997  // Now rest of old
     
    70637079  delete [] integerVariable_;
    70647080  integerVariable_=NULL;
     7081#ifdef COIN_DEVELOP
    70657082  if (newIntegers!=numberIntegers_)
    70667083    printf("changing number of integers from %d to %d\n",
    70677084           numberIntegers_,newIntegers);
     7085#endif
    70687086  numberIntegers_ = newIntegers;
    70697087  integerVariable_ = new int [numberIntegers_];
     
    70887106    }
    70897107  }
     7108#ifdef COIN_DEVELOP
    70907109  if (newIntegers)
    70917110    printf("%d variables were declared integer\n",newIntegers);
     7111#endif
    70927112  int n=numberIntegers_;
    70937113  // Now rest of old
     
    71567176#endif
    71577177  dblParam_[CbcCurrentCutoff]=value;
    7158   // Solvers know about direction
    7159   double direction = solver_->getObjSense();
    7160   solver_->setDblParam(OsiDualObjectiveLimit,value*direction); }
     7178  if (solver_) {
     7179    // Solvers know about direction
     7180    double direction = solver_->getObjSense();
     7181    solver_->setDblParam(OsiDualObjectiveLimit,value*direction);
     7182  }
     7183}
    71617184
    71627185
  • trunk/Cbc/src/CbcModel.hpp

    r687 r696  
    15241524   */
    15251525  void gutsOfDestructor2();
     1526  /** Clears out enough to reset CbcModel cutoff etc
     1527   */
     1528  void resetModel();
    15261529  //@}
    15271530
     
    20472050class OsiClpSolverInterface;
    20482051int CbcMain (int argc, const char *argv[],OsiClpSolverInterface & solver,CbcModel ** babSolver);
     2052int CbcMain (int argc, const char *argv[],CbcModel & babSolver);
    20492053// four ways of calling
    20502054int callCbc(const char * input2, OsiClpSolverInterface& solver1);
     
    20522056int callCbc(const std::string input2, OsiClpSolverInterface& solver1);
    20532057int callCbc(const std::string input2) ;
     2058// When we want to load up CbcModel with options first
     2059void CbcMain0 (CbcModel & babSolver);
     2060int CbcMain1 (int argc, const char *argv[],CbcModel & babSolver);
     2061// two ways of calling
     2062int callCbc(const char * input2, CbcModel & babSolver);
     2063int callCbc(const std::string input2, CbcModel & babSolver);
     2064// And when CbcMain0 already called to initialize
     2065int callCbc1(const char * input2, CbcModel & babSolver);
     2066int callCbc1(const std::string input2, CbcModel & babSolver);
    20542067#endif
  • trunk/Cbc/src/CbcSolver.cpp

    r687 r696  
    11751175#endif
    11761176}
    1177 int callCbc(const char * input2, OsiClpSolverInterface& solver1)
     1177int callCbc1(const char * input2, CbcModel & model)
    11781178{
    11791179  char * input = strdup(input2);
     
    12261226  CbcOrClpReadCommand=stdin;
    12271227  noPrinting=false;
    1228   int returnCode = CbcMain(n+2,(const char **)argv,solver1,NULL);
     1228  int returnCode = CbcMain1(n+2,const_cast<const char **>(argv),model);
    12291229  for (int k=0;k<n+2;k++)
    12301230    free(argv[k]);
     
    12321232  return returnCode;
    12331233}
     1234int callCbc1(const std::string input2, CbcModel & babSolver)
     1235{
     1236  char * input3 = strdup(input2.c_str());
     1237  int returnCode=callCbc1(input3,babSolver);
     1238  free(input3);
     1239  return returnCode;
     1240}
     1241int callCbc(const char * input2, CbcModel & babSolver)
     1242{
     1243  CbcMain0(babSolver);
     1244  return callCbc1(input2,babSolver);
     1245}
     1246int callCbc(const std::string input2, CbcModel & babSolver)
     1247{
     1248  char * input3 = strdup(input2.c_str());
     1249  CbcMain0(babSolver);
     1250  int returnCode=callCbc1(input3,babSolver);
     1251  free(input3);
     1252  return returnCode;
     1253}
     1254int callCbc(const char * input2, OsiClpSolverInterface& solver1)
     1255{
     1256  CbcModel model(solver1);
     1257  return callCbc(input2,model);
     1258}
    12341259int callCbc(const char * input2)
    12351260{
    12361261  {
    12371262    OsiClpSolverInterface solver1;
    1238      return callCbc(input2,solver1);
     1263    return callCbc(input2,solver1);
    12391264  }
    12401265}
     
    12561281
    12571282int CbcMain (int argc, const char *argv[],
    1258              OsiClpSolverInterface & originalSolver,
    1259              CbcModel **miplibSolver)
     1283             CbcModel  & model)
     1284{
     1285  CbcMain0(model);
     1286  return CbcMain1(argc,argv,model);
     1287}
     1288#define CBCMAXPARAMETERS 200
     1289static CbcOrClpParam parameters[CBCMAXPARAMETERS];
     1290static int numberParameters=0 ;
     1291void CbcMain0 (CbcModel  & model)
     1292{
     1293  OsiClpSolverInterface * originalSolver = dynamic_cast<OsiClpSolverInterface *> (model.solver());
     1294  assert (originalSolver);
     1295  CoinMessageHandler * generalMessageHandler = originalSolver->messageHandler();
     1296  generalMessageHandler->setPrefix(true);
     1297  OsiSolverInterface * solver = model.solver();
     1298  OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
     1299  ClpSimplex * lpSolver = clpSolver->getModelPtr();
     1300  clpSolver->messageHandler()->setLogLevel(0) ;
     1301  model.messageHandler()->setLogLevel(1);
     1302  lpSolver->setPerturbation(50);
     1303  lpSolver->messageHandler()->setPrefix(false);
     1304  establishParams(numberParameters,parameters) ;
     1305  const char dirsep =  CoinFindDirSeparator();
     1306  std::string directory = (dirsep == '/' ? "./" : ".\\");
     1307  std::string defaultDirectory = directory;
     1308  std::string importFile ="";
     1309  std::string exportFile ="default.mps";
     1310  std::string importBasisFile ="";
     1311  std::string importPriorityFile ="";
     1312  std::string debugFile="";
     1313  std::string printMask="";
     1314  std::string exportBasisFile ="default.bas";
     1315  std::string saveFile ="default.prob";
     1316  std::string restoreFile ="default.prob";
     1317  std::string solutionFile ="stdout";
     1318  std::string solutionSaveFile ="solution.file";
     1319  int doIdiot=-1;
     1320  int outputFormat=2;
     1321  int substitution=3;
     1322  int dualize=0;
     1323  int preSolve=5;
     1324  int doSprint=-1;
     1325  int testOsiParameters=-1;
     1326  parameters[whichParam(BASISIN,numberParameters,parameters)].setStringValue(importBasisFile);
     1327  parameters[whichParam(PRIORITYIN,numberParameters,parameters)].setStringValue(importPriorityFile);
     1328  parameters[whichParam(BASISOUT,numberParameters,parameters)].setStringValue(exportBasisFile);
     1329  parameters[whichParam(DEBUG,numberParameters,parameters)].setStringValue(debugFile);
     1330  parameters[whichParam(PRINTMASK,numberParameters,parameters)].setStringValue(printMask);
     1331  parameters[whichParam(DIRECTORY,numberParameters,parameters)].setStringValue(directory);
     1332  parameters[whichParam(DUALBOUND,numberParameters,parameters)].setDoubleValue(lpSolver->dualBound());
     1333  parameters[whichParam(DUALTOLERANCE,numberParameters,parameters)].setDoubleValue(lpSolver->dualTolerance());
     1334  parameters[whichParam(EXPORT,numberParameters,parameters)].setStringValue(exportFile);
     1335  parameters[whichParam(IDIOT,numberParameters,parameters)].setIntValue(doIdiot);
     1336  parameters[whichParam(IMPORT,numberParameters,parameters)].setStringValue(importFile);
     1337  parameters[whichParam(PRESOLVETOLERANCE,numberParameters,parameters)].setDoubleValue(1.0e-8);
     1338  int slog = whichParam(SOLVERLOGLEVEL,numberParameters,parameters);
     1339  int log = whichParam(LOGLEVEL,numberParameters,parameters);
     1340  parameters[slog].setIntValue(0);
     1341  parameters[log].setIntValue(1);
     1342  parameters[whichParam(MAXFACTOR,numberParameters,parameters)].setIntValue(lpSolver->factorizationFrequency());
     1343  parameters[whichParam(MAXITERATION,numberParameters,parameters)].setIntValue(lpSolver->maximumIterations());
     1344  parameters[whichParam(OUTPUTFORMAT,numberParameters,parameters)].setIntValue(outputFormat);
     1345  parameters[whichParam(PRESOLVEPASS,numberParameters,parameters)].setIntValue(preSolve);
     1346  parameters[whichParam(PERTVALUE,numberParameters,parameters)].setIntValue(lpSolver->perturbation());
     1347  parameters[whichParam(PRIMALTOLERANCE,numberParameters,parameters)].setDoubleValue(lpSolver->primalTolerance());
     1348  parameters[whichParam(PRIMALWEIGHT,numberParameters,parameters)].setDoubleValue(lpSolver->infeasibilityCost());
     1349  parameters[whichParam(RESTORE,numberParameters,parameters)].setStringValue(restoreFile);
     1350  parameters[whichParam(SAVE,numberParameters,parameters)].setStringValue(saveFile);
     1351  //parameters[whichParam(TIMELIMIT,numberParameters,parameters)].setDoubleValue(1.0e8);
     1352  parameters[whichParam(TIMELIMIT_BAB,numberParameters,parameters)].setDoubleValue(1.0e8);
     1353  parameters[whichParam(SOLUTION,numberParameters,parameters)].setStringValue(solutionFile);
     1354  parameters[whichParam(SAVESOL,numberParameters,parameters)].setStringValue(solutionSaveFile);
     1355  parameters[whichParam(SPRINT,numberParameters,parameters)].setIntValue(doSprint);
     1356  parameters[whichParam(SUBSTITUTION,numberParameters,parameters)].setIntValue(substitution);
     1357  parameters[whichParam(DUALIZE,numberParameters,parameters)].setIntValue(dualize);
     1358  model.setNumberBeforeTrust(10);
     1359  parameters[whichParam(NUMBERBEFORE,numberParameters,parameters)].setIntValue(5);
     1360  parameters[whichParam(MAXNODES,numberParameters,parameters)].setIntValue(model.getMaximumNodes());
     1361  model.setNumberStrong(5);
     1362  parameters[whichParam(STRONGBRANCHING,numberParameters,parameters)].setIntValue(model.numberStrong());
     1363  parameters[whichParam(INFEASIBILITYWEIGHT,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcInfeasibilityWeight));
     1364  parameters[whichParam(INTEGERTOLERANCE,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcIntegerTolerance));
     1365  parameters[whichParam(INCREMENT,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcCutoffIncrement));
     1366  parameters[whichParam(TESTOSI,numberParameters,parameters)].setIntValue(testOsiParameters);
     1367  parameters[whichParam(FPUMPTUNE,numberParameters,parameters)].setIntValue(1003);
     1368#ifdef CBC_THREAD
     1369  parameters[whichParam(THREADS,numberParameters,parameters)].setIntValue(0);
     1370#endif
     1371  // Set up likely cut generators and defaults
     1372  parameters[whichParam(PREPROCESS,numberParameters,parameters)].setCurrentOption("on");
     1373  parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(128|64|1);
     1374  parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(1);
     1375  parameters[whichParam(CUTPASSINTREE,numberParameters,parameters)].setIntValue(1);
     1376  parameters[whichParam(MOREMIPOPTIONS,numberParameters,parameters)].setIntValue(-1);
     1377  parameters[whichParam(MAXHOTITS,numberParameters,parameters)].setIntValue(100);
     1378  parameters[whichParam(CUTSSTRATEGY,numberParameters,parameters)].setCurrentOption("on");
     1379  parameters[whichParam(HEURISTICSTRATEGY,numberParameters,parameters)].setCurrentOption("on");
     1380  parameters[whichParam(NODESTRATEGY,numberParameters,parameters)].setCurrentOption("fewest");
     1381  parameters[whichParam(GOMORYCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1382  parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1383  parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1384  parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption("off");
     1385  parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1386  parameters[whichParam(MIXEDCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1387  parameters[whichParam(FLOWCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     1388  parameters[whichParam(TWOMIRCUTS,numberParameters,parameters)].setCurrentOption("root");
     1389  parameters[whichParam(LANDPCUTS,numberParameters,parameters)].setCurrentOption("off");
     1390  parameters[whichParam(RESIDCUTS,numberParameters,parameters)].setCurrentOption("off");
     1391  parameters[whichParam(ROUNDING,numberParameters,parameters)].setCurrentOption("on");
     1392  parameters[whichParam(FPUMP,numberParameters,parameters)].setCurrentOption("on");
     1393  parameters[whichParam(GREEDY,numberParameters,parameters)].setCurrentOption("on");
     1394  parameters[whichParam(COMBINE,numberParameters,parameters)].setCurrentOption("on");
     1395  parameters[whichParam(RINS,numberParameters,parameters)].setCurrentOption("off");
     1396  parameters[whichParam(COSTSTRATEGY,numberParameters,parameters)].setCurrentOption("off");
     1397}
     1398int CbcMain1 (int argc, const char *argv[],
     1399             CbcModel  & model)
    12601400{
    12611401  /* Note
     
    12631403     It should only have one solver known to it.
    12641404  */
    1265   CoinMessageHandler * generalMessageHandler = originalSolver.messageHandler();
    1266   generalMessageHandler->setPrefix(true);
    1267   CoinMessages generalMessages = originalSolver.getModelPtr()->messages();
     1405  OsiClpSolverInterface * originalSolver = dynamic_cast<OsiClpSolverInterface *> (model.solver());
     1406  assert (originalSolver);
     1407  CoinMessageHandler * generalMessageHandler = originalSolver->messageHandler();
     1408  CoinMessages generalMessages = originalSolver->getModelPtr()->messages();
    12681409  char generalPrint[10000];
    1269   if (originalSolver.getModelPtr()->logLevel()==0)
     1410  if (originalSolver->getModelPtr()->logLevel()==0)
    12701411    noPrinting=true;
     1412  // see if log in list
     1413  for (int i=1;i<argc;i++) {
     1414    if (!strncmp(argv[i],"log",3)) {
     1415      const char * equals = strchr(argv[i],'=');
     1416      if (equals&&atoi(equals+1)>0)
     1417        noPrinting=false;
     1418      else
     1419        noPrinting=true;
     1420      break;
     1421    } else if (!strncmp(argv[i],"-log",4)&&i<argc-1) {
     1422      if (atoi(argv[i+1])>0)
     1423        noPrinting=false;
     1424      else
     1425        noPrinting=true;
     1426      break;
     1427    }
     1428  }
    12711429  {
    12721430    double time1 = CoinCpuTime(),time2;
    1273     bool goodModel=(originalSolver.getNumRows()&&originalSolver.getNumCols()) ? true : false;
    1274     OsiClpSolverInterface solver1;
    1275     if (goodModel)
    1276       solver1=originalSolver;
    1277     /*int kkkkkk=0;
    1278     while (kkkkkk==0) {
    1279       time2=CoinCpuTime();
    1280       if (time2-time1>10.0) {
    1281         printf("time %g\n",time2);
    1282         time1=time2;
    1283       }
    1284       }*/
     1431    bool goodModel=(originalSolver->getNumRows()&&originalSolver->getNumCols()) ? true : false;
    12851432
    12861433    CoinSighandler_t saveSignal=SIG_DFL;
     
    12881435    saveSignal = signal(SIGINT,signal_handler);
    12891436    // Set up all non-standard stuff
    1290     CbcModel model(solver1);
    12911437    CbcModel * babModel = NULL;
    1292     model.setNumberBeforeTrust(21);
    12931438    int cutPass=-1234567;
    12941439    int cutPassInTree=-1234567;
     
    13001445    OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
    13011446    ClpSimplex * lpSolver = clpSolver->getModelPtr();
    1302     clpSolver->messageHandler()->setLogLevel(0) ;
    1303     model.messageHandler()->setLogLevel(1);
     1447    if (noPrinting) {
     1448      setCbcOrClpPrinting(false);
     1449      lpSolver->setLogLevel(0);
     1450    }
    13041451    // For priorities etc
    13051452    int * priorities=NULL;
     
    15141661    double gapRatio=1.0e100;
    15151662    double tightenFactor=0.0;
    1516     lpSolver->setPerturbation(50);
    1517     lpSolver->messageHandler()->setPrefix(false);
    15181663    const char dirsep =  CoinFindDirSeparator();
    15191664    std::string directory = (dirsep == '/' ? "./" : ".\\");
     
    15331678    std::string solutionFile ="stdout";
    15341679    std::string solutionSaveFile ="solution.file";
    1535 #define CBCMAXPARAMETERS 200
    1536     CbcOrClpParam parameters[CBCMAXPARAMETERS];
    1537     int numberParameters ;
    1538     establishParams(numberParameters,parameters) ;
    1539     parameters[whichParam(BASISIN,numberParameters,parameters)].setStringValue(importBasisFile);
    1540     parameters[whichParam(PRIORITYIN,numberParameters,parameters)].setStringValue(importPriorityFile);
    1541     parameters[whichParam(BASISOUT,numberParameters,parameters)].setStringValue(exportBasisFile);
    1542     parameters[whichParam(DEBUG,numberParameters,parameters)].setStringValue(debugFile);
    1543     parameters[whichParam(PRINTMASK,numberParameters,parameters)].setStringValue(printMask);
    1544     parameters[whichParam(DIRECTORY,numberParameters,parameters)].setStringValue(directory);
    1545     parameters[whichParam(DUALBOUND,numberParameters,parameters)].setDoubleValue(lpSolver->dualBound());
    1546     parameters[whichParam(DUALTOLERANCE,numberParameters,parameters)].setDoubleValue(lpSolver->dualTolerance());
    1547     parameters[whichParam(EXPORT,numberParameters,parameters)].setStringValue(exportFile);
    1548     parameters[whichParam(IDIOT,numberParameters,parameters)].setIntValue(doIdiot);
    1549     parameters[whichParam(IMPORT,numberParameters,parameters)].setStringValue(importFile);
    1550     parameters[whichParam(PRESOLVETOLERANCE,numberParameters,parameters)].setDoubleValue(1.0e-8);
    15511680    int slog = whichParam(SOLVERLOGLEVEL,numberParameters,parameters);
    15521681    int log = whichParam(LOGLEVEL,numberParameters,parameters);
    1553     parameters[slog].setIntValue(0);
    1554     parameters[log].setIntValue(1);
    1555     parameters[whichParam(MAXFACTOR,numberParameters,parameters)].setIntValue(lpSolver->factorizationFrequency());
    1556     parameters[whichParam(MAXITERATION,numberParameters,parameters)].setIntValue(lpSolver->maximumIterations());
    1557     parameters[whichParam(OUTPUTFORMAT,numberParameters,parameters)].setIntValue(outputFormat);
    1558     parameters[whichParam(PRESOLVEPASS,numberParameters,parameters)].setIntValue(preSolve);
    1559     parameters[whichParam(PERTVALUE,numberParameters,parameters)].setIntValue(lpSolver->perturbation());
    1560     parameters[whichParam(PRIMALTOLERANCE,numberParameters,parameters)].setDoubleValue(lpSolver->primalTolerance());
    1561     parameters[whichParam(PRIMALWEIGHT,numberParameters,parameters)].setDoubleValue(lpSolver->infeasibilityCost());
    1562     parameters[whichParam(RESTORE,numberParameters,parameters)].setStringValue(restoreFile);
    1563     parameters[whichParam(SAVE,numberParameters,parameters)].setStringValue(saveFile);
    1564     //parameters[whichParam(TIMELIMIT,numberParameters,parameters)].setDoubleValue(1.0e8);
    1565     parameters[whichParam(TIMELIMIT_BAB,numberParameters,parameters)].setDoubleValue(1.0e8);
    1566     parameters[whichParam(SOLUTION,numberParameters,parameters)].setStringValue(solutionFile);
    1567     parameters[whichParam(SAVESOL,numberParameters,parameters)].setStringValue(solutionSaveFile);
    1568     parameters[whichParam(SPRINT,numberParameters,parameters)].setIntValue(doSprint);
    1569     parameters[whichParam(SUBSTITUTION,numberParameters,parameters)].setIntValue(substitution);
    1570     parameters[whichParam(DUALIZE,numberParameters,parameters)].setIntValue(dualize);
    1571     model.setNumberBeforeTrust(10);
    1572     parameters[whichParam(NUMBERBEFORE,numberParameters,parameters)].setIntValue(5);
    1573     parameters[whichParam(MAXNODES,numberParameters,parameters)].setIntValue(model.getMaximumNodes());
    1574     model.setNumberStrong(5);
    1575     parameters[whichParam(STRONGBRANCHING,numberParameters,parameters)].setIntValue(model.numberStrong());
    1576     parameters[whichParam(INFEASIBILITYWEIGHT,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcInfeasibilityWeight));
    1577     parameters[whichParam(INTEGERTOLERANCE,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcIntegerTolerance));
    15781682    double normalIncrement=model.getCutoffIncrement();;
    1579     parameters[whichParam(INCREMENT,numberParameters,parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcCutoffIncrement));
    1580     parameters[whichParam(TESTOSI,numberParameters,parameters)].setIntValue(testOsiParameters);
    1581     parameters[whichParam(FPUMPTUNE,numberParameters,parameters)].setIntValue(1003);
    1582 #ifdef CBC_THREAD
    1583     parameters[whichParam(THREADS,numberParameters,parameters)].setIntValue(0);
    1584 #endif
    15851683    if (testOsiParameters>=0) {
    15861684      // trying nonlinear - switch off some stuff
     
    15881686    }
    15891687    // Set up likely cut generators and defaults
    1590     parameters[whichParam(PREPROCESS,numberParameters,parameters)].setCurrentOption("on");
    1591     parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(128|64|1);
    1592     parameters[whichParam(MIPOPTIONS,numberParameters,parameters)].setIntValue(1);
    1593     parameters[whichParam(CUTPASSINTREE,numberParameters,parameters)].setIntValue(1);
    1594     parameters[whichParam(MOREMIPOPTIONS,numberParameters,parameters)].setIntValue(-1);
    1595     parameters[whichParam(MAXHOTITS,numberParameters,parameters)].setIntValue(100);
    1596     parameters[whichParam(CUTSSTRATEGY,numberParameters,parameters)].setCurrentOption("on");
    1597     parameters[whichParam(HEURISTICSTRATEGY,numberParameters,parameters)].setCurrentOption("on");
    1598     parameters[whichParam(NODESTRATEGY,numberParameters,parameters)].setCurrentOption("fewest");
    15991688    int nodeStrategy=0;
    16001689    int doSOS=1;
     
    16061695    // set default action (0=off,1=on,2=root)
    16071696    int gomoryAction=3;
    1608     parameters[whichParam(GOMORYCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16091697
    16101698    CglProbing probingGen;
     
    16241712    // set default action (0=off,1=on,2=root)
    16251713    int probingAction=1;
    1626     parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16271714
    16281715    CglKnapsackCover knapsackGen;
     
    16301717    // set default action (0=off,1=on,2=root)
    16311718    int knapsackAction=3;
    1632     parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16331719
    16341720    CglRedSplit redsplitGen;
     
    16371723    // Off as seems to give some bad cuts
    16381724    int redsplitAction=0;
    1639     parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption("off");
    16401725
    16411726    CglClique cliqueGen(false,true);
     
    16451730    // set default action (0=off,1=on,2=root)
    16461731    int cliqueAction=3;
    1647     parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16481732
    16491733    CglMixedIntegerRounding2 mixedGen;
    16501734    // set default action (0=off,1=on,2=root)
    16511735    int mixedAction=3;
    1652     parameters[whichParam(MIXEDCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16531736
    16541737    CglFlowCover flowGen;
    16551738    // set default action (0=off,1=on,2=root)
    16561739    int flowAction=3;
    1657     parameters[whichParam(FLOWCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    16581740
    16591741    CglTwomir twomirGen;
     
    16611743    // set default action (0=off,1=on,2=root)
    16621744    int twomirAction=2;
    1663     parameters[whichParam(TWOMIRCUTS,numberParameters,parameters)].setCurrentOption("root");
    16641745    CglLandP landpGen;
    16651746    // set default action (0=off,1=on,2=root)
    16661747    int landpAction=0;
    1667     parameters[whichParam(LANDPCUTS,numberParameters,parameters)].setCurrentOption("off");
    16681748    CglResidualCapacity residualCapacityGen;
    16691749    // set default action (0=off,1=on,2=root)
    16701750    int residualCapacityAction=0;
    1671     parameters[whichParam(RESIDCUTS,numberParameters,parameters)].setCurrentOption("off");
    16721751    // Stored cuts
    16731752    bool storedCuts = false;
    16741753
    16751754    bool useRounding=true;
    1676     parameters[whichParam(ROUNDING,numberParameters,parameters)].setCurrentOption("on");
    16771755    bool useFpump=true;
    1678     parameters[whichParam(FPUMP,numberParameters,parameters)].setCurrentOption("on");
    16791756    bool useGreedy=true;
    1680     parameters[whichParam(GREEDY,numberParameters,parameters)].setCurrentOption("on");
    16811757    bool useCombine=true;
    1682     parameters[whichParam(COMBINE,numberParameters,parameters)].setCurrentOption("on");
    16831758    bool useLocalTree=false;
    16841759    bool useRINS=false;
    1685     parameters[whichParam(RINS,numberParameters,parameters)].setCurrentOption("off");
    1686     parameters[whichParam(COSTSTRATEGY,numberParameters,parameters)].setCurrentOption("off");
    16871760    int useCosts=0;
    16881761    // don't use input solution
     
    44384511                  babModel->setBranchingMethod(decision);
    44394512                }
    4440                 *miplibSolver = babModel;
     4513                model = *babModel;
    44414514                return 777;
    44424515              } else {
     
    44914564                // and put back in very original solver
    44924565                {
    4493                   ClpSimplex * original = originalSolver.getModelPtr();
     4566                  ClpSimplex * original = originalSolver->getModelPtr();
    44944567                  double * lower = original->columnLower();
    44954568                  double * upper = original->columnUpper();
     
    44994572                  for (int i=0;i<n;i++) {
    45004573                    solution[i]=bestSolution[i];
    4501                     if (solver1.isInteger(i)) {
     4574                    if (originalSolver->isInteger(i)) {
    45024575                      lower[i]=solution[i];
    45034576                      upper[i]=solution[i];
     
    50055078                      }
    50065079                    }
    5007                     clpSolver->writeMpsNative(fileName.c_str(),(const char **) rowNames,(const char **) columnNames,
     5080                    clpSolver->writeMpsNative(fileName.c_str(),const_cast<const char **> (rowNames),const_cast<const char **> (columnNames),
    50085081                                              (outputFormat-1)/2,1+((outputFormat-1)&1));
    50095082                    if (rowNames) {
  • trunk/Cbc/src/Cbc_ampl.cpp

    r687 r696  
    151151        { "special", 0, ASL_Sufkind_con },
    152152        /*{ "special", 0, ASL_Sufkind_con },*/
    153         { strdup("sstatus"), 0, ASL_Sufkind_var, 0 },
    154         { strdup("sstatus"), 0, ASL_Sufkind_con, 0 },
     153        { "sstatus", 0, ASL_Sufkind_var, 0 },
     154        { "sstatus", 0, ASL_Sufkind_con, 0 },
    155155        { "upPseudocost", 0, ASL_Sufkind_var | ASL_Sufkind_real }
    156156#if 0
  • trunk/Cbc/src/CoinSolve.cpp

    r640 r696  
    2525{
    2626  OsiClpSolverInterface solver1;
    27   CbcModel * babSolver = NULL;
    28   int returnCode = CbcMain (argc, argv,solver1,&babSolver);
     27  CbcModel model(solver1);
     28  int returnCode = CbcMain (argc, argv,model);
    2929  if (returnCode!=777) {
    3030    return returnCode;
    3131  } else {
    3232    // do miplib
    33     CbcClpUnitTest(*babSolver);
     33    CbcClpUnitTest(model);
    3434    return 0;
    3535  }
Note: See TracChangeset for help on using the changeset viewer.