Changeset 1849 for stable


Ignore:
Timestamp:
Feb 29, 2012 3:49:09 AM (8 years ago)
Author:
forrest
Message:

allow multiple solutions in standalone executable

Location:
stable/1.14/Clp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable/1.14/Clp/src/CbcOrClpParam.cpp

    r1753 r1849  
    869869               model.setIntParam(CbcModel::CbcMaxNumSol, value);
    870870               break;
     871          case CBC_PARAM_INT_MAXSAVEDSOLS:
     872               oldValue = model.maximumSavedSolutions();
     873               model.setMaximumSavedSolutions(value);
     874               break;
    871875          case CBC_PARAM_INT_STRONGBRANCHING:
    872876               oldValue = model.numberStrong();
     
    923927          value = model.getIntParam(CbcModel::CbcMaxNumSol);
    924928          break;
     929     case CBC_PARAM_INT_MAXSAVEDSOLS:
     930          value = model.maximumSavedSolutions();
     931          break;
    925932     case CBC_PARAM_INT_STRONGBRANCHING:
    926933          value = model.numberStrong();
     
    23262333     );
    23272334     parameters[numberParameters++] =
    2328           CbcOrClpParam("maxS!olutions", "Maximum number of solutions to get",
     2335          CbcOrClpParam("maxSaved!Solutions", "Maximum number of solutions to save",
     2336                        0, 2147483647, CBC_PARAM_INT_MAXSAVEDSOLS);
     2337     parameters[numberParameters-1].setLonghelp
     2338     (
     2339          "Number of solutions to save."
     2340     );
     2341     parameters[numberParameters++] =
     2342          CbcOrClpParam("maxSo!lutions", "Maximum number of solutions to get",
    23292343                        1, 2147483647, CBC_PARAM_INT_MAXSOLS);
    23302344     parameters[numberParameters-1].setLonghelp
     
    24592473     );
    24602474#ifdef COIN_HAS_CBC
     2475     parameters[numberParameters++] =
     2476          CbcOrClpParam("nextB!estSolution", "Prints next best saved solution to file",
     2477                        CLP_PARAM_ACTION_NEXTBESTSOLUTION);
     2478     parameters[numberParameters-1].setLonghelp
     2479     (
     2480          "To write best solution, just use solution.  This prints next best (if exists) \
     2481 and then deletes it. \
     2482 This will write a primitive solution file to the given file name.  It will use the default\
     2483 directory given by 'directory'.  A name of '$' will use the previous value for the name.  This\
     2484 is initialized to 'stdout'.  The amount of output can be varied using printi!ngOptions or printMask."
     2485     );
    24612486     parameters[numberParameters++] =
    24622487          CbcOrClpParam("node!Strategy", "What strategy to use to select nodes",
  • stable/1.14/Clp/src/CbcOrClpParam.hpp

    r1753 r1849  
    134134     CLP_PARAM_INT_LOGLEVEL ,
    135135#endif
     136     CBC_PARAM_INT_MAXSAVEDSOLS,
    136137
    137138     CLP_PARAM_STR_DIRECTION = 201,
     
    259260     CBC_PARAM_ACTION_USERCBC,
    260261     CBC_PARAM_ACTION_DOHEURISTIC,
     262     CLP_PARAM_ACTION_NEXTBESTSOLUTION,
    261263
    262264     CBC_PARAM_NOTUSED_OSLSTUFF = 401,
  • stable/1.14/Clp/src/ClpSimplex.cpp

    r1753 r1849  
    19961996          return 1;
    19971997     } else if (numberIterations_ > 1000 + 10 * (numberRows_ + (numberColumns_ >> 2)) && matrix_->type()<15) {
     1998          // A bit worried problem may be cycling - lets factorize at random intervals for a short period
     1999          int numberTooManyIterations = numberIterations_ - 10 * (numberRows_ + (numberColumns_ >> 2));
    19982000          double random = randomNumberGenerator_.randomDouble();
     2001          int window = numberTooManyIterations%5000;
     2002          if (window<2*maximumPivots)
     2003            random = 0.2*random+0.8; // randomly re-factorize but not too soon
     2004          else
     2005            random=1.0; // switch off if not in window of opportunity
    19992006          int maxNumber = (forceFactorization_ < 0) ? maximumPivots : CoinMin(forceFactorization_, maximumPivots);
    20002007          if (factorization_->pivots() >= random * maxNumber) {
Note: See TracChangeset for help on using the changeset viewer.