Changeset 1093


Ignore:
Timestamp:
Sep 1, 2007 7:12:33 AM (12 years ago)
Author:
forrest
Message:

nonlinear

Location:
trunk/Clp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/CbcOrClpParam.cpp

    r1088 r1093  
    18641864  parameters[numberParameters++]=
    18651865    CbcOrClpParam("maxN!odes","Maximum number of nodes to do",
    1866                   0,2147483647,MAXNODES);
     1866                  -1,2147483647,MAXNODES);
    18671867  parameters[numberParameters-1].setLonghelp
    18681868    (
     
    26932693  parameters[numberParameters++]=
    26942694    CbcOrClpParam("vub!heuristic","Type of vub heuristic",
    2695                   -2,10,VUBTRY,false);
     2695                  -2,20,VUBTRY,false);
    26962696  parameters[numberParameters-1].setLonghelp
    26972697    (
  • trunk/Clp/src/ClpSimplex.cpp

    r1084 r1093  
    60546054    delete [] dsol;
    60556055  }
     6056  optimizationDirection_ = modelObject.optimizationDirection(); 
    60566057  return returnCode;
    60576058}
  • trunk/Clp/src/ClpSimplexNonlinear.cpp

    r1061 r1093  
    12991299      longArray->clear();
    13001300      // take out comment to try slightly different idea
    1301       if (nPasses+nTotalPasses>3000)
     1301      if (nPasses+nTotalPasses>3000||nBigPasses>200)
    13021302        break;
    13031303      if (!nPasses) {
     
    33373337    return primalSLP(numberPasses,deltaTolerance);
    33383338  }
     3339  // Are we minimizing or maximizing
     3340  double whichWay=optimizationDirection();
     3341  if (whichWay<0.0)
     3342    whichWay=-1.0;
     3343  else if (whichWay>0.0)
     3344    whichWay=1.0;
    33393345  // check all matrix for odd rows is empty
    33403346  int iConstraint;
     
    33553361  // Both these should be modified depending on problem
    33563362  // Possibly start with big bounds
    3357   double penalties[]={1.0e-2,1.0,1.0e9};
     3363  double penalties[]={1.0e-2,1.0e3,1.0e9};
    33583364  //double bounds[] = {1.0e-2,1.0,COIN_DBL_MAX};
    33593365  double bounds[] = {1.0e-1,1.0e2,COIN_DBL_MAX};
     
    35273533  delete [] mark;
    35283534  // get feasible
     3535  if (whichWay<0.0) {
     3536    newModel.setOptimizationDirection(1.0);
     3537    double * objective = newModel.objective();
     3538    for (int iColumn=0;iColumn<numberColumns_;iColumn++)
     3539      objective[iColumn] = - objective[iColumn];
     3540  }
    35293541  newModel.primal(1);
    35303542  // still infeasible
     
    35583570  double objectiveOffset2;
    35593571  getDblParam(ClpObjOffset,objectiveOffset);
     3572  objectiveOffset *= whichWay;
    35603573  for (jNon=0;jNon<numberNonLinearColumns;jNon++) {
    35613574    iColumn=listNonLinearColumn[jNon];
     
    35973610  bool zeroTargetDrop=false;
    35983611  double * gradient = new double [numberColumns_];
     3612  // keep sum of artificials
     3613#define KEEP_SUM 5
     3614  double sumArt[KEEP_SUM];
     3615  for (jNon=0;jNon<KEEP_SUM;jNon++)
     3616    sumArt[jNon]=COIN_DBL_MAX;
    35993617#define SMALL_FIX 0.0
    36003618  for (iPass=0;iPass<numberPasses;iPass++) {
     
    36463664             numberColumns_*sizeof(double));
    36473665    }
     3666    if (whichWay<0.0) {
     3667      for (int iColumn=0;iColumn<numberColumns_;iColumn++)
     3668        objective[iColumn] = - objective[iColumn];
     3669    }
    36483670    for (iConstraint=0;iConstraint<numberConstraints;iConstraint++) {
    36493671      ClpConstraint * constraint = constraints[iConstraint];
     
    36943716    printf("%d artificial infeasibilities - summing to %g\n",
    36953717           numberInfeas,sumInfeas);
     3718    for (jNon=0;jNon<KEEP_SUM-1;jNon++)
     3719      sumArt[jNon]=sumArt[jNon+1];
     3720    sumArt[KEEP_SUM-1]=sumInfeas;
     3721    if (sumInfeas>0.01&&sumInfeas*1.1>sumArt[0]&&objective[numberColumns_+1]<1.0e5) {
     3722      // not doing very well - increase - be more sophisticated later
     3723      lastObjective=COIN_DBL_MAX;
     3724      for (jNon=0;jNon<KEEP_SUM;jNon++)
     3725        sumArt[jNon]=COIN_DBL_MAX;
     3726      for (iColumn=numberColumns_;iColumn<numberColumns2;iColumn+=SEGMENTS) {
     3727        objective[iColumn+1] *= 1.5;
     3728      }
     3729      for (jNon=0;jNon<numberNonLinearColumns;jNon++)
     3730        if (trust[jNon]>0.1)
     3731          trust[jNon] *= 2.0;
     3732        else
     3733          trust[jNon] = 0.1;
     3734    }
    36963735    double infValue=0.0;
    36973736    double objValue=0.0;
     
    37093748      objValue=objective_->objectiveValue(this,solution);
    37103749    }
     3750    objValue *= whichWay;
    37113751    double infPenalty=0.0;
    37123752    // This penalty is for target drop
     
    38113851    lastObjective += objectiveAdjustment;
    38123852    if (infValue)
    3813       printf("Sum infeasibilities %g - penalty %g",infValue,infPenalty);
     3853      printf("Sum infeasibilities %g - penalty %g ",infValue,infPenalty);
    38143854    if (objectiveOffset2)
    3815       printf("offset2 %g\n",objectiveOffset2);
     3855      printf("offset2 %g ",objectiveOffset2);
    38163856    objValue -= objectiveOffset2;
    3817     printf("True objective %g\n",objValue);
     3857    printf("True objective %g or maybe %g\n",objValue,objValue+objectiveOffset2);
    38183858    objValue += infPenalty+infPenalty2;
    38193859    if (iPass) {
Note: See TracChangeset for help on using the changeset viewer.