Changeset 1990


Ignore:
Timestamp:
Nov 11, 2013 12:50:42 PM (4 years ago)
Author:
forrest
Message:

merge 1989 from stable

Location:
trunk/Clp/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src

  • trunk/Clp/src/AbcSimplex.cpp

    r1910 r1990  
    188188  abcLower_ = ClpCopyOfArray(rhs.abcLower_, sizeArray);
    189189  abcUpper_ = ClpCopyOfArray(rhs.abcUpper_, sizeArray);
    190   abcCost_ = ClpCopyOfArray(rhs.abcCost_, sizeArray);
     190  abcCost_ = ClpCopyOfArray(rhs.abcCost_, sizeArray+maximumNumberTotal_);
    191191  abcDj_ = ClpCopyOfArray(rhs.abcDj_, sizeArray);
     192
    192193  abcSolution_ = ClpCopyOfArray(rhs.abcSolution_, sizeArray+maximumNumberTotal_);
    193194  abcPerturbation_ = ClpCopyOfArray(rhs.abcPerturbation_,sizeArray);
     
    368369    abcDualRowPivot_ = new AbcDualRowSteepest();
    369370    abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest();
    370     internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),sizeArray+maximumNumberTotal_);
     371    internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
     372                               sizeArray+maximumNumberTotal_);
    371373    abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
    372374    abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
    373     abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     375    abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
    374376    abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
    375377    abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
     
    417419  scaleFromExternal_ = resizeArray(scaleFromExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0);
    418420  //scaleToExternal_ = resizeArray(scaleToExternal_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,1,0);
    419   internalStatus_ = resizeArray(internalStatus_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,numberTotal_);
     421  internalStatus_ = resizeArray(internalStatus_,maximumAbcNumberRows_,
     422                                maximumAbcNumberColumns_,
     423                                newSize1,newSize2,numberTotal_);
    420424  abcLower_ = resizeArray(abcLower_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0);
    421425  abcUpper_ = resizeArray(abcUpper_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0);
    422   abcCost_ = resizeArray(abcCost_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0);
     426  abcCost_ = resizeArray(abcCost_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,numberTotal_);
    423427  abcDj_ = resizeArray(abcDj_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,0);
    424428  abcSolution_ = resizeArray(abcSolution_,maximumAbcNumberRows_,maximumAbcNumberColumns_,newSize1,newSize2,numberTotal_);
     
    649653  previousVector->clear();
    650654  // accumulate non basic stuff
    651  
    652655  double *  COIN_RESTRICT array = arrayVector->denseVector();
    653656  CoinAbcScatterZeroTo(abcSolution_,abcPivotVariable_,numberRows_);
     
    10391042    }
    10401043    status = CoinMax(numberSlacks - numberRows_, 0);
     1044    if (status)
     1045      printf("%d singularities\n",status);
    10411046    // special case if all slack
    10421047    if (numberSlacks == numberRows_) {
     
    37343739  }
    37353740  int totalNumberIterations=numberIterations_;
     3741  if (problemStatus_ == 10 && (moreSpecialOptions_&32768)!=0 &&sumDualInfeasibilities_ < 0.1) {
     3742    problemStatus_=0;
     3743  }
    37363744#ifndef TRY_ABC_GUS
    37373745  if (problemStatus_==10) {
     
    57835791  } else if (which==-1) {
    57845792    for (int i=0;i<ABC_NUMBER_USEFUL_NORMAL;i++) {
    5785       if (usefulArray_[i].getNumElements())
     5793      if (usefulArray_[i].getNumElements()) {
    57865794        usefulArray_[i].clear();
     5795        usefulArray_[i].clearAndReset();
     5796      }
    57875797    }
    57885798    stateOfProblem_&= ~255;
  • trunk/Clp/src/AbcSimplexDual.cpp

    r1910 r1990  
    15951595  // not free
    15961596  int lastSequence = -1;
     1597  double lastTheta = 0.0;
    15971598  double lastPivotValue = 0.0;
    15981599  double thisPivotValue=0.0;
     
    16601661           numberRemaining);
    16611662#endif
    1662     if (totalThru + thruThis >= fabs(dualOut_) ||
     1663    if (totalThru + thruThis > fabs(dualOut_)-fabs(1.0e-9*dualOut_)-1.0e-12 ||
    16631664        (increaseInObjective + increaseInThis < 0.0&&bestSequence>=0) || !numberRemaining) {
    16641665      // We should be pivoting in this batch
     
    17991800        if (theta < 0.0)
    18001801          thruThis += fabs(dualOut_); // force using this one
    1801         if (increaseInObjective < 0.0 && increase < 0.0 && lastSequence >= 0) {
     1802        if (((increaseInObjective < 0.0 && increase < 0.0)||
     1803             (theta>1.0e9 && lastTheta < 1.0e-5))
     1804            && lastSequence >= 0) {
    18021805          // back
    18031806          // We may need to be more careful - we could do by
     
    18091812          totalThru += thruThis;
    18101813          increaseInObjective += increaseInThis;
     1814          lastTheta=theta;
    18111815        }
    18121816        if (bestPivot < 0.1 * bestEverPivot &&
     
    22832287  // save arrays
    22842288  CoinMemcpyN(internalStatus_, numberTotal_, internalStatusSaved_);
     2289  // save costs
     2290  CoinMemcpyN(abcCost_,numberTotal_,abcCost_+2*numberTotal_);
    22852291  CoinMemcpyN(abcSolution_,numberTotal_,solutionSaved_);
    22862292}
     
    22972303    // trouble - restore solution
    22982304    CoinMemcpyN(internalStatusSaved_, numberTotal_, internalStatus_);
     2305    CoinMemcpyN(abcCost_+2*numberTotal_,numberTotal_,abcCost_);
    22992306    CoinMemcpyN(solutionSaved_,numberTotal_, abcSolution_);
    23002307    int *  COIN_RESTRICT abcPivotVariable = abcPivotVariable_;
     
    29382945          abort();
    29392946        }
     2947        moveToBasic();
    29402948#if PARTITION_ROW_COPY==1
    29412949        int iVector=getAvailableArray();
     
    29452953        // get primal and dual solutions
    29462954        numberBlackMarks+=gutsOfSolution(3);
     2955        //gutsOfSolution(1);
     2956        makeNonFreeVariablesDualFeasible();
    29472957      }
    29482958    }
     
    59185928    dualTolerance_ = dblParam_[ClpDualTolerance];
    59195929    primalTolerance_ = dblParam_[ClpPrimalTolerance];
    5920     int tryType=moreSpecialOptions_/65536;
     5930    int tryType=moreSpecialOptions_/131072;
    59215931    if (tryType<5) {
    59225932      currentDualBound_=1.0e8;
  • trunk/Clp/src/ClpSimplex.cpp

    r1972 r1990  
    612612               //     largestPrimalError_);
    613613               // throw out up to 1000 structurals
     614               int maxOut = (allowedInfeasibility_==10.0) ? 1000 : 100;
    614615               int iRow;
    615616               int * sort = new int[numberRows_];
     
    647648               }
    648649               CoinSort_2(save, save + numberOut, sort);
    649                numberOut = CoinMin(1000, numberOut);
     650               numberOut = CoinMin(maxOut, numberOut);
    650651               for (iRow = 0; iRow < numberOut; iRow++) {
    651652                    int jRow = sort[iRow];
     
    54175418       problemStatus_ = 10; // clean up in primal as fake bounds
    54185419     }
    5419      if ((moreSpecialOptions_&262144)!=0&&
     5420     if ((moreSpecialOptions_&524288)!=0&&
    54205421         !nonLinearCost_->numberInfeasibilities()&&
    54215422         fabs(dblParam_[ClpDualObjectiveLimit])>1.0e30) {
  • trunk/Clp/src/ClpSimplex.hpp

    r1972 r1990  
    11871187         8192 bit - don't even think of using primal if user asks for dual (and vv)
    11881188         16384 bit - in initialSolve so be more flexible
    1189          debug
    1190          32768 bit - do dual in netlibd
    1191          65536 (*3) initial stateDualColumn
    1192          262144 bit - stop when primal feasible
     1189         32768 bit - don't swap algorithms from dual if small infeasibility
     1190         65536 bit - perturb in postsolve cleanup (even if < 10000 rows)
     1191         131072 bit (*3) initial stateDualColumn
     1192         524288 bit - stop when primal feasible
    11931193     */
    11941194     inline int moreSpecialOptions() const {
     
    12111211         8192 bit - don't even think of using primal if user asks for dual (and vv)
    12121212         16384 bit - in initialSolve so be more flexible
    1213          debug
    1214          32768 bit - do dual in netlibd
    1215          65536 (*3) initial stateDualColumn
    1216          262144 bit - stop when primal feasible
     1213         32768 bit - don't swap algorithms from dual if small infeasibility
     1214         65536 bit - perturb in postsolve cleanup (even if < 10000 rows)
     1215         131072 bit (*3) initial stateDualColumn
     1216         524288 bit - stop when primal feasible
    12171217     */
    12181218     inline void setMoreSpecialOptions(int value) {
  • trunk/Clp/src/ClpSimplexPrimal.cpp

    r1973 r1990  
    499499                    problemStatus_ = 3;
    500500                    break;
    501                } else if ((moreSpecialOptions_&262144)!=0&&
     501               } else if ((moreSpecialOptions_&524288)!=0&&
    502502                          !nonLinearCost_->numberInfeasibilities()&&
    503503                          fabs(dblParam_[ClpDualObjectiveLimit])>1.0e30) {
  • trunk/Clp/src/ClpSolve.cpp

    r1972 r1990  
    659659#endif
    660660    //if (abcState()==3||abcState()==4) {
    661     //abcModel2->setMoreSpecialOptions((65536*2)|abcModel2->moreSpecialOptions());
     661    //abcModel2->setMoreSpecialOptions((131072*2)|abcModel2->moreSpecialOptions());
    662662    //}
    663663    //if (processTune>0&&processTune<8)
    664     //abcModel2->setMoreSpecialOptions(abcModel2->moreSpecialOptions()|65536*processTune);
     664    //abcModel2->setMoreSpecialOptions(abcModel2->moreSpecialOptions()|131072*processTune);
    665665#if ABC_INSTRUMENT
    666666    double startTimeCpu=CoinCpuTime();
     
    21852185
    21862186          int iPass;
    2187           double lastObjective = 1.0e31;
     2187          double lastObjective[] = {1.0e31,1.0e31};
    21882188          // It will be safe to allow dense
    21892189          model2->setInitialDenseFactorization(true);
     
    22642264#ifdef ABC_INHERIT
    22652265                      //small.writeMps("try.mps");
    2266                       if (iPass)
     2266                      if (iPass||!numberArtificials)
    22672267                         small.dealWithAbc(1,1);
    22682268                       else
    22692269                         small.dealWithAbc(0,0);
    22702270#else
    2271                       if (iPass)
     2271                      if (iPass||!numberArtificials)
    22722272                         small.primal(1);
    22732273                      else
    22742274                         small.dual(0);
    22752275#endif
     2276                      if (small.problemStatus())
     2277                        small.dual(0);
    22762278#else
    22772279                         int numberColumns = small.numberColumns();
     
    23682370               if (iPass > 20)
    23692371                    sumArtificials = 0.0;
    2370                if ((small.objectiveValue()*optimizationDirection_ > lastObjective - 1.0e-7 && iPass > 5 && sumArtificials < 1.0e-8) ||
     2372               if ((small.objectiveValue()*optimizationDirection_ > lastObjective[1] - 1.0e-7 && iPass > 5 && sumArtificials < 1.0e-8) ||
    23712373                         (!small.numberIterations() && iPass) ||
    23722374                         iPass == maxSprintPass - 1 || small.status() == 3) {
     
    23742376                    break; // finished
    23752377               } else {
    2376                     lastObjective = small.objectiveValue() * optimizationDirection_;
     2378                    lastObjective[1] = lastObjective[0];
     2379                    lastObjective[0] = small.objectiveValue() * optimizationDirection_;
    23772380                    double tolerance;
    23782381                    double averageNegDj = sumNegative / static_cast<double> (numberNegative + 1);
     
    31133116                         dual();
    31143117                    } else {
    3115                       if (numberRows_<10000)
    3116                         setPerturbation(100); // probably better to perturb after n its
    3117                       else if (savePerturbation<100)
    3118                         setPerturbation(51); // probably better to perturb after n its
     3118                        if ((moreSpecialOptions_&65536)==0) {
     3119                          if (numberRows_<10000)
     3120                            setPerturbation(100); // probably better to perturb after n its
     3121                          else if (savePerturbation<100)
     3122                            setPerturbation(51); // probably better to perturb after n its
     3123                        }
    31193124#ifndef ABC_INHERIT
    31203125                        primal(1);
  • trunk/Clp/src/CoinAbcHelperFunctions.cpp

    r1910 r1990  
    262262{
    263263#ifndef INTEL_COMPILER
    264 #pragma simd
     264// was #pragma simd
    265265#endif
    266266#if UNROLL_MULTIPLY_ADD==0
     
    282282{
    283283#ifndef INTEL_COMPILER
    284 #pragma simd
     284// was #pragma simd
    285285#endif
    286286#if UNROLL_MULTIPLY_ADD==0
     
    303303     //printf("a\n");
    304304#ifndef INTEL_COMPILER
    305 #pragma simd
     305// was #pragma simd
    306306#endif
    307307     /*cilk_*/ for (int i = 0; i < size; i++)
     
    317317  //printf("b\n");
    318318#ifndef INTEL_COMPILER
    319 #pragma simd
     319// was #pragma simd
    320320#endif
    321321     /*cilk_*/ for (int i=0;i<size;i++) {
     
    337337  //printf("c\n");
    338338#ifndef INTEL_COMPILER
    339 #pragma simd
     339// was #pragma simd
    340340#endif
    341341     /*cilk_*/ for (int i=0;i<size;i++) {
     
    355355  // used printf("d\n");
    356356#ifndef INTEL_COMPILER
    357 #pragma simd
     357// was #pragma simd
    358358#endif
    359359#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    368368     // used printf("e\n");
    369369#ifndef INTEL_COMPILER
    370 #pragma simd
     370// was #pragma simd
    371371#endif
    372372#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    394394  //printf("f\n");
    395395#ifndef INTEL_COMPILER
    396 #pragma simd
     396// was #pragma simd
    397397#endif
    398398     /*cilk_*/ for (int i=0;i<size;i++) {
     
    409409     printf("g\n");
    410410#ifndef INTEL_COMPILER
    411 #pragma simd
     411// was #pragma simd
    412412#endif
    413413#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    424424          if (multiplier2 == 1.0) {
    425425#ifndef INTEL_COMPILER
    426 #pragma simd
     426// was #pragma simd
    427427#endif
    428428               /*cilk_*/ for (int i = 0; i < size; i++)
     
    430430          } else if (multiplier2 == -1.0) {
    431431#ifndef INTEL_COMPILER
    432 #pragma simd
     432// was #pragma simd
    433433#endif
    434434               /*cilk_*/ for (int i = 0; i < size; i++)
     
    436436          } else if (multiplier2 == 0.0) {
    437437#ifndef INTEL_COMPILER
    438 #pragma simd
     438// was #pragma simd
    439439#endif
    440440               /*cilk_*/ for (int i = 0; i < size; i++)
     
    442442          } else {
    443443#ifndef INTEL_COMPILER
    444 #pragma simd
     444// was #pragma simd
    445445#endif
    446446               /*cilk_*/ for (int i = 0; i < size; i++)
     
    450450          if (multiplier2 == 1.0) {
    451451#ifndef INTEL_COMPILER
    452 #pragma simd
     452// was #pragma simd
    453453#endif
    454454               /*cilk_*/ for (int i = 0; i < size; i++)
     
    456456          } else if (multiplier2 == -1.0) {
    457457#ifndef INTEL_COMPILER
    458 #pragma simd
     458// was #pragma simd
    459459#endif
    460460               /*cilk_*/ for (int i = 0; i < size; i++)
     
    462462          } else if (multiplier2 == 0.0) {
    463463#ifndef INTEL_COMPILER
    464 #pragma simd
     464// was #pragma simd
    465465#endif
    466466               /*cilk_*/ for (int i = 0; i < size; i++)
     
    468468          } else {
    469469#ifndef INTEL_COMPILER
    470 #pragma simd
     470// was #pragma simd
    471471#endif
    472472               /*cilk_*/ for (int i = 0; i < size; i++)
     
    478478          } else if (multiplier2 == -1.0) {
    479479#ifndef INTEL_COMPILER
    480 #pragma simd
     480// was #pragma simd
    481481#endif
    482482               /*cilk_*/ for (int i = 0; i < size; i++)
     
    484484          } else if (multiplier2 == 0.0) {
    485485#ifndef INTEL_COMPILER
    486 #pragma simd
     486// was #pragma simd
    487487#endif
    488488               /*cilk_*/ for (int i = 0; i < size; i++)
     
    490490          } else {
    491491#ifndef INTEL_COMPILER
    492 #pragma simd
     492// was #pragma simd
    493493#endif
    494494               /*cilk_*/ for (int i = 0; i < size; i++)
     
    498498          if (multiplier2 == 1.0) {
    499499#ifndef INTEL_COMPILER
    500 #pragma simd
     500// was #pragma simd
    501501#endif
    502502               /*cilk_*/ for (int i = 0; i < size; i++)
     
    504504          } else if (multiplier2 == -1.0) {
    505505#ifndef INTEL_COMPILER
    506 #pragma simd
     506// was #pragma simd
    507507#endif
    508508               /*cilk_*/ for (int i = 0; i < size; i++)
     
    510510          } else if (multiplier2 == 0.0) {
    511511#ifndef INTEL_COMPILER
    512 #pragma simd
     512// was #pragma simd
    513513#endif
    514514               /*cilk_*/ for (int i = 0; i < size; i++)
     
    516516          } else {
    517517#ifndef INTEL_COMPILER
    518 #pragma simd
     518// was #pragma simd
    519519#endif
    520520               /*cilk_*/ for (int i = 0; i < size; i++)
     
    530530     double value = 0.0;
    531531#ifndef INTEL_COMPILER
    532 #pragma simd
     532// was #pragma simd
    533533#endif
    534534     /*cilk_*/ for (int i = 0; i < size; i++)
     
    544544     norm2 = 0.0;
    545545#ifndef INTEL_COMPILER
    546 #pragma simd
     546// was #pragma simd
    547547#endif
    548548     /*cilk_*/ for (int i = 0; i < size; i++) {
     
    558558     // used printf("k\n");
    559559#ifndef INTEL_COMPILER
    560 #pragma simd
     560// was #pragma simd
    561561#endif
    562562#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    573573     // used printf("l\n");
    574574#ifndef INTEL_COMPILER
    575 #pragma simd
     575// was #pragma simd
    576576#endif
    577577#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    588588     // used printf("m\n");
    589589#ifndef INTEL_COMPILER
    590 #pragma simd
     590// was #pragma simd
    591591#endif
    592592#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    604604  //printf("n\n");
    605605#ifndef INTEL_COMPILER
    606 #pragma simd
     606// was #pragma simd
    607607#endif
    608608     /*cilk_*/ for (int i=0;i<number;i++) {
     
    619619     // used printf("o\n");
    620620#ifndef INTEL_COMPILER
    621 #pragma simd
     621// was #pragma simd
    622622#endif
    623623#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
     
    631631     // used printf("p\n");
    632632#ifndef INTEL_COMPILER
    633 #pragma simd
     633// was #pragma simd
    634634#endif
    635635#pragma cilk_grainsize=CILK_FOR_GRAINSIZE
  • trunk/Clp/src/OsiClp

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.