Changeset 1677 for trunk/Clp/src/ClpDynamicMatrix.cpp
 Timestamp:
 Jan 21, 2011 1:01:03 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpDynamicMatrix.cpp
r1676 r1677 94 94 lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); 95 95 upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); 96 status_ = ClpCopyOfArray(rhs.status_, 2*numberSets_ );96 status_ = ClpCopyOfArray(rhs.status_, 2*numberSets_+4*sizeof(int)); 97 97 model_ = rhs.model_; 98 98 sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; … … 237 237 flags_ &= ~1; 238 238 // resize model (matrix stays same) 239 int newRowSize = numberRows + CoinMin(numberSets_, CoinMax(frequency, numberRows)) + 1;239 int newRowSize = numberRows + CoinMin(numberSets_, frequency+numberRows) + 1; 240 240 model>resize(newRowSize, numberNeeded); 241 241 for (i = numberRows; i < newRowSize; i++) … … 259 259 keyVariable_ = new int[numberSets_]; 260 260 if (status) { 261 status_ = ClpCopyOfArray(status, 2*numberSets_ );261 status_ = ClpCopyOfArray(status, 2*numberSets_+4*sizeof(int)); 262 262 assert (dynamicStatus); 263 263 dynamicStatus_ = ClpCopyOfArray(dynamicStatus, 2*numberGubColumns_); 264 264 } else { 265 status_ = new unsigned char [2*numberSets_ ];265 status_ = new unsigned char [2*numberSets_+4*sizeof(int)]; 266 266 memset(status_, 0, numberSets_); 267 267 int i; … … 356 356 lowerSet_ = ClpCopyOfArray(rhs.lowerSet_, numberSets_); 357 357 upperSet_ = ClpCopyOfArray(rhs.upperSet_, numberSets_); 358 status_ = ClpCopyOfArray(rhs.status_, 2*numberSets_ );358 status_ = ClpCopyOfArray(rhs.status_, 2*numberSets_+4*sizeof(int)); 359 359 model_ = rhs.model_; 360 360 sumDualInfeasibilities_ = rhs. sumDualInfeasibilities_; … … 865 865 if (lowerSet_[iSet] == upperSet_[iSet]) 866 866 setStatus(iSet, ClpSimplex::isFixed); 867 #if 0 867 868 if (getStatus(iSet) != model>getStatus(sequenceOut)) 868 869 printf("** set %d status %d, var status %d\n", iSet, 869 870 getStatus(iSet), model>getStatus(sequenceOut)); 871 #endif 870 872 } 871 873 ClpMatrixBase::updatePivot(model, oldInValue, oldOutValue); … … 1044 1046 { 1045 1047 int returnCode = 0; 1048 #if 0 //ndef NDEBUG 1049 { 1050 int numberColumns = model>numberColumns(); 1051 int numberRows = model>numberRows(); 1052 int * pivotVariable = model>pivotVariable(); 1053 if (pivotVariable&&model>numberIterations()) { 1054 for (int i=numberStaticRows_+numberActiveSets_;i<numberRows;i++) { 1055 assert (pivotVariable[i]==i+numberColumns); 1056 } 1057 } 1058 } 1059 #endif 1046 1060 switch (mode) { 1047 1061 // Fill in pivotVariable … … 1087 1101 case 5: { 1088 1102 memcpy(status_+numberSets_,status_,numberSets_); 1103 memcpy(status_+2*numberSets_,&numberActiveSets_,sizeof(int)); 1089 1104 memcpy(dynamicStatus_+maximumGubColumns_, 1090 1105 dynamicStatus_,maximumGubColumns_); … … 1094 1109 case 6: { 1095 1110 memcpy(status_,status_+numberSets_,numberSets_); 1111 memcpy(&numberActiveSets_,status_+2*numberSets_,sizeof(int)); 1096 1112 memcpy(dynamicStatus_,dynamicStatus_+maximumGubColumns_, 1097 1113 maximumGubColumns_); … … 1266 1282 return 1; 1267 1283 } 1284 #ifndef NDEBUG 1285 { 1286 int numberColumns = model>numberColumns(); 1287 int numberRows = model>numberRows(); 1288 int * pivotVariable = model>pivotVariable(); 1289 for (int i=numberStaticRows_+numberActiveSets_;i<numberRows;i++) { 1290 assert (pivotVariable[i]==i+numberColumns); 1291 } 1292 } 1293 #endif 1268 1294 // lookup array 1269 1295 int * active = new int [numberActiveSets_]; … … 1479 1505 } 1480 1506 } 1507 if (iPut<numberStaticRows_+numberActiveSets_) { 1508 printf("lost %d sets\n", 1509 numberStaticRows_+numberActiveSets_iPut); 1510 iPut = numberStaticRows_+numberActiveSets_; 1511 } 1481 1512 for (i = numberActiveSets_; i < currentNumberActiveSets; i++) { 1482 1513 pivotVariable[iPut++] = i + base3; 1483 1514 } 1484 assert (iPut == numberRows);1515 //assert (iPut == numberRows); 1485 1516 } 1486 1517 #ifdef CLP_DEBUG … … 2288 2319 keyVariable_[iSet] = whichKey; 2289 2320 } 2321 // clean up pivotVariable 2322 int numberColumns = model_>numberColumns(); 2323 int numberRows = model_>numberRows(); 2324 int * pivotVariable = model_>pivotVariable(); 2325 if (pivotVariable) { 2326 for (int i=0; i<numberStaticRows_+numberActiveSets_;i++) { 2327 if (model_>getRowStatus(i)!=ClpSimplex::basic) 2328 pivotVariable[i]=1; 2329 else 2330 pivotVariable[i]=numberColumns+i; 2331 } 2332 for (int i=numberStaticRows_+numberActiveSets_;i<numberRows;i++) { 2333 pivotVariable[i]=i+numberColumns; 2334 } 2335 int put=1; 2336 for (int i=0;i<numberColumns;i++) { 2337 if (model_>getColumnStatus(i)==ClpSimplex::basic) { 2338 while(put<numberRows) { 2339 put++; 2340 if (pivotVariable[put]==1) { 2341 pivotVariable[put]=i; 2342 break; 2343 } 2344 } 2345 } 2346 } 2347 for (int i=CoinMax(put,0);i<numberRows;i++) { 2348 if (pivotVariable[i]==1) 2349 pivotVariable[i]=i+numberColumns; 2350 } 2351 } 2352 if (rhsOffset_) { 2353 double * cost = model_>costRegion(); 2354 double * columnLower = model_>lowerRegion(); 2355 double * columnUpper = model_>upperRegion(); 2356 double * solution = model_>solutionRegion(); 2357 int numberRows = model_>numberRows(); 2358 for (int i = numberActiveSets_; i < numberRowsnumberStaticRows_; i++) { 2359 int iSequence = i + numberStaticRows_ + numberColumns; 2360 solution[iSequence] = 0.0; 2361 columnLower[iSequence] = COIN_DBL_MAX; 2362 columnUpper[iSequence] = COIN_DBL_MAX; 2363 cost[iSequence] = 0.0; 2364 model_>nonLinearCost()>setOne(iSequence, solution[iSequence], 2365 columnLower[iSequence], 2366 columnUpper[iSequence], 0.0); 2367 model_>setStatus(iSequence, ClpSimplex::basic); 2368 rhsOffset_[i+numberStaticRows_] = 0.0; 2369 } 2370 #if 0 2371 for (int i=0;i<numberStaticRows_;i++) 2372 printf("%d offset %g\n", 2373 i,rhsOffset_[i]); 2374 #endif 2375 } 2290 2376 numberActiveColumns_ = firstAvailable_; 2377 #if 0 2378 for (iSet = 0; iSet < numberSets_; iSet++) { 2379 for (int j=startSet_[iSet];j<startSet_[iSet+1];j++) { 2380 if (getDynamicStatus(j)==soloKey) 2381 printf("%d in set %d is solo key\n",j,iSet); 2382 else if (getDynamicStatus(j)==inSmall) 2383 printf("%d in set %d is in small\n",j,iSet); 2384 } 2385 } 2386 #endif 2291 2387 return; 2292 2388 }
Note: See TracChangeset
for help on using the changeset viewer.