Changeset 159 for trunk


Ignore:
Timestamp:
Apr 4, 2003 3:58:05 PM (17 years ago)
Author:
forrest
Message:

Still not very good

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpNonLinearCost.cpp

    r157 r159  
    162162  for (iSequence=0;iSequence<numberTotal;iSequence++) {
    163163    lower_[put] = -COIN_DBL_MAX;
    164     setInfeasible(put,true);
    165164    whichRange_[iSequence]=put+1;
    166165    double thisCost;
     
    208207      setInfeasible(put-1,true);
    209208      cost_[put++] = 1.0e50;
     209    }
     210    int iFirst = start_[iSequence];
     211    if (lower_[iFirst] != -COIN_DBL_MAX) {
     212      setInfeasible(iFirst,true);
     213      whichRange_[iSequence]=iFirst+1;
     214    } else {
     215      whichRange_[iSequence]=iFirst;
    210216    }
    211217    start_[iSequence+1]=put;
  • trunk/ClpSimplex.cpp

    r156 r159  
    131131{
    132132  gutsOfDelete(0);
     133  delete nonLinearCost_;
    133134}
    134135//#############################################################################
     
    11851186  primalColumnPivot_ = NULL;
    11861187  gutsOfDelete(0);
     1188  specialOptions_ =0;
     1189  delete nonLinearCost_;
     1190  nonLinearCost_ = NULL;
    11871191  gutsOfCopy(rhs);
    11881192  solveType_=1; // say simplex based life form
     
    12871291  if (this != &rhs) {
    12881292    gutsOfDelete(0);
     1293    specialOptions_=0;
     1294    delete nonLinearCost_;
     1295    nonLinearCost_ = NULL;
    12891296    ClpModel::operator=(rhs);
    12901297    gutsOfCopy(rhs);
     
    13981405  if (rhs.nonLinearCost_!=NULL)
    13991406    nonLinearCost_ = new ClpNonLinearCost(*rhs.nonLinearCost_);
     1407  else
     1408    nonLinearCost_=NULL;
    14001409  solveType_=rhs.solveType_;
    14011410}
     
    14301439  delete [] columnScale_;
    14311440  columnScale_ = NULL;
    1432   delete nonLinearCost_;
    1433   nonLinearCost_ = NULL;
     1441  if ((specialOptions_&2)==0) {
     1442    delete nonLinearCost_;
     1443    nonLinearCost_ = NULL;
     1444  }
    14341445  int i;
    14351446  for (i=0;i<6;i++) {
     
    41904201  }
    41914202  nonLinearCost_ = new ClpNonLinearCost(this,starts,lower,gradient);
     4203  specialOptions_ |= 2; // say keep
    41924204  return returnCode;
    41934205}
  • trunk/Samples/piece.cpp

    r158 r159  
    3131                    m.getObjCoefficients(),
    3232                    m.getRowLower(),m.getRowUpper());
    33   model1.primal();
     33  model1.dual();
    3434  // Get data arrays
    3535  const CoinPackedMatrix * matrix1 = m.getMatrixByCol();
     
    6767  memcpy(rowLower2,rowLower1,numberRows*sizeof(double));
    6868  memcpy(rowUpper2,rowUpper1,numberRows*sizeof(double));
     69  double objectiveOffset = 0.0;
    6970
    7071  // For new solution
     
    9697  start2[++numberColumns2]=numberElements;
    9798
    98   int xxxx=0;
    9999  // Now check for duplicates
    100100  for (iColumn=1;iColumn<numberColumns;iColumn++) {
     
    113113      }
    114114    }
    115     if (iColumn>xxxx)
    116       ifcopy=0;
    117115    if (ifcopy) {
    118116      // subtract out from rhs
     
    123121        assert(fabs(fixed-columnLower1[iColumn-1])<1.0e-8);
    124122      }
     123      // do offset
     124      objectiveOffset += fixed*objective1[iColumn];
    125125      for (int j=start1[iColumn];j<start1[iColumn]+length1[iColumn];j++) {
    126126        int iRow = row1[j];
     
    162162  printf("New number of columns  = %d\n",numberColumns2);
    163163  printf("New number of elements = %d\n",numberElements);
     164  printf("Objective offset is %g\n",objectiveOffset);
    164165
    165166  /*  for (int k=0; k<20; k++)
     
    207208  delete [] newSolution;
    208209
     210  const double * solution = model.primalColumnSolution();
     211  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     212    printf("%g ",solution[iColumn]);
     213  printf("\n");
    209214  // solve
    210215  model.primal(1);
     216  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     217    printf("%g ",solution[iColumn]);
     218  printf("\n");
     219  model.primal(1);
     220  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     221    printf("%g ",solution[iColumn]);
     222  printf("\n");
     223  model.primal();
     224  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     225    printf("%g ",solution[iColumn]);
     226  printf("\n");
     227  model.allSlackBasis();
     228  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     229    printf("%g ",solution[iColumn]);
     230  printf("\n");
     231  model.primal();
     232  for (iColumn=0;iColumn<numberColumns2;iColumn++)
     233    printf("%g ",solution[iColumn]);
     234  printf("\n");
    211235  return 0;
    212236}   
  • trunk/include/ClpSimplex.hpp

    r156 r159  
    827827  */
    828828  ClpNonLinearCost * nonLinearCost_;
    829   /// For advanced options
     829  /** For advanced options
     830      1 - Don't keep changing infeasibility weight
     831      2 - keep nonLinearCost round solves
     832  */
    830833  unsigned int specialOptions_;
    831834  /// So we know when to be cautious
Note: See TracChangeset for help on using the changeset viewer.