Changeset 2358
 Timestamp:
 Jan 21, 2018 6:28:16 AM (9 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcSolver.cpp
r2357 r2358 4072 4072 } 4073 4073 if (preProcess && type == CBC_PARAM_ACTION_BAB) { 4074 #ifndef CBC_OTHER_SOLVER4075 // See if sos from mps file4076 if (numberSOS == 0 && clpSolver>numberSOS() && doSOS) {4077 // SOS4078 numberSOS = clpSolver>numberSOS();4079 const CoinSet * setInfo = clpSolver>setInfo();4080 sosStart = new int [numberSOS+1];4081 sosType = new char [numberSOS];4082 int i;4083 int nTotal = 0;4084 sosStart[0] = 0;4085 for ( i = 0; i < numberSOS; i++) {4086 int type = setInfo[i].setType();4087 int n = setInfo[i].numberEntries();4088 sosType[i] = static_cast<char>(type);4089 nTotal += n;4090 sosStart[i+1] = nTotal;4091 }4092 sosIndices = new int[nTotal];4093 sosReference = new double [nTotal];4094 for (i = 0; i < numberSOS; i++) {4095 int n = setInfo[i].numberEntries();4096 const int * which = setInfo[i].which();4097 const double * weights = setInfo[i].weights();4098 int base = sosStart[i];4099 for (int j = 0; j < n; j++) {4100 int k = which[j];4101 sosIndices[j+base] = k;4102 sosReference[j+base] = weights ? weights[j] : static_cast<double> (j);4103 }4104 }4105 }4106 #endif4107 4074 saveSolver = babModel_>solver()>clone(); 4108 4075 /* Do not try and produce equality cliques and … … 8042 8009 // sets to all slack (not necessary?) 8043 8010 lpSolver>createStatus(); 8011 // See if sos 8012 if (clpSolver>numberSOS()) { 8013 // SOS 8014 numberSOS = clpSolver>numberSOS(); 8015 const CoinSet * setInfo = clpSolver>setInfo(); 8016 sosStart = new int [numberSOS+1]; 8017 sosType = new char [numberSOS]; 8018 const double * lower = 8019 clpSolver>getColLower(); 8020 const double * upper = 8021 clpSolver>getColUpper(); 8022 int i; 8023 int nTotal = 0; 8024 sosStart[0] = 0; 8025 for ( i = 0; i < numberSOS; i++) { 8026 int type = setInfo[i].setType(); 8027 int n = setInfo[i].numberEntries(); 8028 sosType[i] = static_cast<char>(type); 8029 nTotal += n; 8030 sosStart[i+1] = nTotal; 8031 } 8032 sosIndices = new int[nTotal]; 8033 sosReference = new double [nTotal]; 8034 for (i = 0; i < numberSOS; i++) { 8035 int n = setInfo[i].numberEntries(); 8036 const int * which = setInfo[i].which(); 8037 const double * weights = setInfo[i].weights(); 8038 int base = sosStart[i]; 8039 for (int j = 0; j < n; j++) { 8040 int k = which[j]; 8041 // don't allow free 8042 if (upper[k]>1.0e15) 8043 clpSolver>setColUpper(k,1.0e15); 8044 if (lower[k]<1.0e15) 8045 clpSolver>setColLower(k,1.0e15); 8046 sosIndices[j+base] = k; 8047 sosReference[j+base] = weights ? weights[j] : static_cast<double> (j); 8048 } 8049 } 8050 } 8044 8051 // make sure integer 8045 8052 // also deal with semicontinuous
Note: See TracChangeset
for help on using the changeset viewer.