Changeset 207 for trunk


Ignore:
Timestamp:
Nov 4, 2005 12:46:02 PM (14 years ago)
Author:
forrest
Message:

fix sol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Test/CoinSolve.cpp

    r204 r207  
    106106{
    107107  OsiSolverInterface * solver = solverMod->clone();
    108   {
     108  if (0) {
    109109    // just get increment
    110110    CbcModel model(*solver);
     
    343343  delete [] which;
    344344  delete [] changeRhs;
     345  delete [] ignore;
    345346  if (numberInteger)
    346347    printf("%d integer variables",numberInteger);
     
    488489    // try larger limit
    489490    gomoryGen.setLimitAtRoot(500);
    490     gomoryGen.setLimit(100);
     491    gomoryGen.setLimit(50);
    491492    // set default action (0=off,1=on,2=root)
    492493    int gomoryAction=3;
     
    517518
    518519    CglRedSplit redsplitGen;
    519     redsplitGen.setLimit(100);
     520    //redsplitGen.setLimit(100);
    520521    // set default action (0=off,1=on,2=root)
    521522    // Off as seems to give some bad cuts
     
    543544    CglTwomir twomirGen;
    544545    // set default action (0=off,1=on,2=root)
    545     int twomirAction=3;
    546     parameters[whichParam(TWOMIRCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
     546    int twomirAction=2;
     547    parameters[whichParam(TWOMIRCUTS,numberParameters,parameters)].setCurrentOption("root");
    547548
    548549    bool useRounding=true;
     
    12711272                /* Do not try and produce equality cliques and
    12721273                   do up to 10 passes */
    1273                 OsiSolverInterface * solver2 = process.preProcess(*saveSolver,false,10);
     1274                OsiSolverInterface * solver2 = process.preProcess(*saveSolver,preProcess==3,10);
    12741275                if (!solver2) {
    12751276                  printf("Pre-processing says infeasible\n");
     
    14921493              time2 = CoinCpuTime();
    14931494              totalTime += time2-time1;
     1495              // For best solution
     1496              double * bestSolution = NULL;
    14941497              if (babModel->getMinimizationObjValue()<1.0e50&&type==BAB) {
    14951498                // post process
    14961499                if (preProcess) {
     1500                  int n = saveSolver->getNumCols();
     1501                  bestSolution = new double [n];
    14971502                  process.postProcess(*babModel->solver());
    14981503                  // Solution now back in saveSolver
    14991504                  babModel->assignSolver(saveSolver);
     1505                  memcpy(bestSolution,babModel->solver()->getColSolution(),n*sizeof(double));
     1506                } else {
     1507                  int n = babModel->solver()->getNumCols();
     1508                  bestSolution = new double [n];
     1509                  memcpy(bestSolution,babModel->solver()->getColSolution(),n*sizeof(double));
    15001510                }
    15011511              }
     
    15031513                clpSolver = dynamic_cast< OsiClpSolverInterface*> (strengthenedModel);
    15041514              lpSolver = clpSolver->getModelPtr();
    1505               if (debugFile=="create"&&babModel->bestSolution()) {
     1515              if (debugFile=="create"&&bestSolution) {
    15061516                saveSolution(lpSolver,"debug.file");
    15071517              }
     
    15141524              }
    15151525              if (type==BAB) {
     1526                //move best solution (should be there -- but ..)
     1527                int n = lpSolver->getNumCols();
     1528                if (bestSolution)
     1529                  memcpy(lpSolver->primalColumnSolution(),bestSolution,n*sizeof(double));
     1530                delete [] bestSolution;
    15161531                std::string statusName[]={"Finished","Stopped on ","Difficulties",
    15171532                                          "","","User ctrl-c"};
     
    23232338                    }
    23242339                    // see if integer
    2325                     if (!lpSolver->isInteger(iColumn)&&printMode==1)
     2340                    if ((!lpSolver->isInteger(iColumn)||fabs(primalColumnSolution[iColumn])<1.0e-8)
     2341                         &&printMode==1)
    23262342                      type=0;
    23272343                    if (type) {
Note: See TracChangeset for help on using the changeset viewer.