Ignore:
Timestamp:
Dec 24, 2018 11:07:36 AM (4 months ago)
Author:
forrest
Message:

Allow a strategy for initial solve where code analyzes problem and guesses at parameters

File:
1 edited

Legend:

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

    r2380 r2384  
    1059410594  delete info;
    1059510595}
     10596// Create a string of commands to guess at best strategy for model
     10597// At present mode is ignored
     10598char *
     10599ClpSimplexOther::guess(int mode) const
     10600{
     10601  if (!numberColumns_) {
     10602    handler_->message(CLP_GENERAL, messages_)
     10603      << "Null model" << CoinMessageEol;
     10604    return NULL;
     10605  }
     10606  char * environment = new char [100];
     10607  double * obj = CoinCopyOfArray(objective(),numberColumns_);
     10608  std::sort(obj,obj+numberColumns_);
     10609  bool allInt=true;
     10610  double average = 0.0;
     10611  double median = obj[numberColumns_/2];
     10612  for (int i=0;i<numberColumns_;i++) {
     10613    if (!isInteger(i))
     10614      allInt=false;
     10615    average += obj[i];
     10616  }
     10617  delete [] obj;
     10618  average /= numberColumns_;
     10619  if (allInt) {
     10620    if (average <= 0.009)
     10621      sprintf(environment,"-idiot 60 -primals");
     10622    else
     10623      sprintf(environment,"-idiot 30 -pertvalue -1483 -primals");
     10624  } else {
     10625    if (median <= 0.75)
     10626      sprintf(environment,"-dualpivot pesteep -psi -1.0 -pertv 52 -duals");
     10627    else
     10628      sprintf(environment,"-idiot 80 -primals");
     10629  }
     10630  char line[140];
     10631  sprintf(line,"%s %s","Commands generated by guess -",environment);
     10632  handler_->message(CLP_GENERAL, messages_)
     10633    << line << CoinMessageEol;
     10634  return environment;
     10635}
Note: See TracChangeset for help on using the changeset viewer.