This class implements a very silly algorithm. More...
#include <Idiot.hpp>
Public Member Functions | |
void | solve2 (CoinMessageHandler *handler, const CoinMessages *messages) |
Stuff for internal use. | |
Constructors and destructor | |
Idiot () | |
Default constructor. | |
Idiot (OsiSolverInterface &model) | |
Constructor with model. | |
Idiot (const Idiot &) | |
Copy constructor. | |
Idiot & | operator= (const Idiot &rhs) |
Assignment operator. This copies the data. | |
~Idiot () | |
Destructor. | |
Algorithmic calls | |
void | solve () |
Get an approximate solution with the idiot code. | |
void | crash (int numberPass, CoinMessageHandler *handler, const CoinMessages *messages) |
Lightweight "crash". | |
void | crossOver (int mode) |
Use simplex to get an optimal solution mode is how many steps the simplex crossover should take to arrive to an extreme point: 0 - chosen,all ever used, all 1 - chosen, all 2 - all 3 - do not do anything - maybe basis + 16 do presolves. | |
Gets and sets of most useful data | |
double | getStartingWeight () const |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
void | setStartingWeight (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getWeightFactor () const |
Weight factor - weight multiplied by this when changes, default 0.333. | |
void | setWeightFactor (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getFeasibilityTolerance () const |
Feasibility tolerance - problem essentially feasible if individual infeasibilities less than this. | |
void | setFeasibilityTolerance (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getReasonablyFeasible () const |
Reasonably feasible. | |
void | setReasonablyFeasible (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getExitInfeasibility () const |
Exit infeasibility - exit if sum of infeasibilities less than this. | |
void | setExitInfeasibility (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getMajorIterations () const |
Major iterations. | |
void | setMajorIterations (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getMinorIterations () const |
Minor iterations. | |
void | setMinorIterations (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getMinorIterations0 () const |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
void | setMinorIterations0 (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getReduceIterations () const |
Reduce weight after this many major iterations. | |
void | setReduceIterations (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getLogLevel () const |
Amount of information - default of 1 should be okay. | |
void | setLogLevel (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getLightweight () const |
How lightweight - 0 not, 1 yes, 2 very lightweight. | |
void | setLightweight (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
int | getStrategy () const |
strategy | |
void | setStrategy (int value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getDropEnoughFeasibility () const |
Fine tuning - okay if feasibility drop this factor. | |
void | setDropEnoughFeasibility (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
double | getDropEnoughWeighted () const |
Fine tuning - okay if weighted obj drop this factor. | |
void | setDropEnoughWeighted (double value) |
Starting weight - small emphasizes feasibility, default 1.0e-4. | |
Private Member Functions | |
IdiotResult | IdiSolve (int nrows, int ncols, double *rowsol, double *colsol, double *pi, double *djs, const double *origcost, double *rowlower, double *rowupper, const double *lower, const double *upper, const double *element, const int *row, const CoinBigIndex *colcc, const int *length, double *lambda, int maxIts, double mu, double drop, double maxmin, double offset, int strategy, double djTol, double djExit, double djFlag, CoinThreadRandom *randomNumberGenerator) |
int | dropping (IdiotResult result, double tolerance, double small, int *nbad) |
IdiotResult | objval (int nrows, int ncols, double *rowsol, double *colsol, double *pi, double *djs, const double *cost, const double *rowlower, const double *rowupper, const double *lower, const double *upper, const double *elemnt, const int *row, const CoinBigIndex *columnStart, const int *length, int extraBlock, int *rowExtra, double *solExtra, double *elemExtra, double *upperExtra, double *costExtra, double weight) |
int | cleanIteration (int iteration, int ordinaryStart, int ordinaryEnd, double *colsol, const double *lower, const double *upper, const double *rowLower, const double *rowUpper, const double *cost, const double *element, double fixTolerance, double &objChange, double &infChange) |
Private Attributes | |
OsiSolverInterface * | model_ |
Underlying model. | |
double | djTolerance_ |
double | mu_ |
double | drop_ |
double | muFactor_ |
double | stopMu_ |
double | smallInfeas_ |
double | reasonableInfeas_ |
double | exitDrop_ |
double | muAtExit_ |
double | exitFeasibility_ |
double | dropEnoughFeasibility_ |
double | dropEnoughWeighted_ |
int * | whenUsed_ |
int | maxBigIts_ |
int | maxIts_ |
int | majorIterations_ |
int | logLevel_ |
int | logFreq_ |
int | checkFrequency_ |
int | lambdaIterations_ |
int | maxIts2_ |
int | strategy_ |
int | lightWeight_ |
This class implements a very silly algorithm.
It has no merit apart from the fact that it gets an approximate solution to some classes of problems. Better if vaguely homogeneous. It works on problems where volume algorithm works and often gets a better primal solution but it has no dual solution.
It can also be used as a "crash" to get a problem started. This is probably its most useful function.
It is based on the idea that algorithms with terrible convergence properties may be okay at first. Throw in some random dubious tricks and the resulting code may be worth keeping as long as you don't look at it.
Definition at line 45 of file Idiot.hpp.
Idiot::Idiot | ( | ) |
Default constructor.
Idiot::Idiot | ( | OsiSolverInterface & | model | ) |
Constructor with model.
Idiot::Idiot | ( | const Idiot & | ) |
Copy constructor.
Idiot::~Idiot | ( | ) |
Destructor.
void Idiot::solve | ( | ) |
Get an approximate solution with the idiot code.
void Idiot::crash | ( | int | numberPass, | |
CoinMessageHandler * | handler, | |||
const CoinMessages * | messages | |||
) |
Lightweight "crash".
void Idiot::crossOver | ( | int | mode | ) |
Use simplex to get an optimal solution mode is how many steps the simplex crossover should take to arrive to an extreme point: 0 - chosen,all ever used, all 1 - chosen, all 2 - all 3 - do not do anything - maybe basis + 16 do presolves.
double Idiot::getStartingWeight | ( | ) | const [inline] |
void Idiot::setStartingWeight | ( | double | value | ) | [inline] |
double Idiot::getWeightFactor | ( | ) | const [inline] |
void Idiot::setWeightFactor | ( | double | value | ) | [inline] |
double Idiot::getFeasibilityTolerance | ( | ) | const [inline] |
void Idiot::setFeasibilityTolerance | ( | double | value | ) | [inline] |
double Idiot::getReasonablyFeasible | ( | ) | const [inline] |
void Idiot::setReasonablyFeasible | ( | double | value | ) | [inline] |
double Idiot::getExitInfeasibility | ( | ) | const [inline] |
void Idiot::setExitInfeasibility | ( | double | value | ) | [inline] |
int Idiot::getMajorIterations | ( | ) | const [inline] |
void Idiot::setMajorIterations | ( | int | value | ) | [inline] |
int Idiot::getMinorIterations | ( | ) | const [inline] |
Minor iterations.
Do this number of tiny steps before deciding whether to change weights etc. Default - dubious sqrt(Number of Rows). Good numbers 105 to 405 say (5 is dubious method of making sure idiot is not trying to be clever which it may do every 10 minor iterations)
void Idiot::setMinorIterations | ( | int | value | ) | [inline] |
int Idiot::getMinorIterations0 | ( | ) | const [inline] |
void Idiot::setMinorIterations0 | ( | int | value | ) | [inline] |
int Idiot::getReduceIterations | ( | ) | const [inline] |
void Idiot::setReduceIterations | ( | int | value | ) | [inline] |
int Idiot::getLogLevel | ( | ) | const [inline] |
void Idiot::setLogLevel | ( | int | value | ) | [inline] |
int Idiot::getLightweight | ( | ) | const [inline] |
void Idiot::setLightweight | ( | int | value | ) | [inline] |
void Idiot::setStrategy | ( | int | value | ) | [inline] |
double Idiot::getDropEnoughFeasibility | ( | ) | const [inline] |
void Idiot::setDropEnoughFeasibility | ( | double | value | ) | [inline] |
double Idiot::getDropEnoughWeighted | ( | ) | const [inline] |
void Idiot::setDropEnoughWeighted | ( | double | value | ) | [inline] |
void Idiot::solve2 | ( | CoinMessageHandler * | handler, | |
const CoinMessages * | messages | |||
) |
Stuff for internal use.
Does actual work
IdiotResult Idiot::IdiSolve | ( | int | nrows, | |
int | ncols, | |||
double * | rowsol, | |||
double * | colsol, | |||
double * | pi, | |||
double * | djs, | |||
const double * | origcost, | |||
double * | rowlower, | |||
double * | rowupper, | |||
const double * | lower, | |||
const double * | upper, | |||
const double * | element, | |||
const int * | row, | |||
const CoinBigIndex * | colcc, | |||
const int * | length, | |||
double * | lambda, | |||
int | maxIts, | |||
double | mu, | |||
double | drop, | |||
double | maxmin, | |||
double | offset, | |||
int | strategy, | |||
double | djTol, | |||
double | djExit, | |||
double | djFlag, | |||
CoinThreadRandom * | randomNumberGenerator | |||
) | [private] |
int Idiot::dropping | ( | IdiotResult | result, | |
double | tolerance, | |||
double | small, | |||
int * | nbad | |||
) | [private] |
IdiotResult Idiot::objval | ( | int | nrows, | |
int | ncols, | |||
double * | rowsol, | |||
double * | colsol, | |||
double * | pi, | |||
double * | djs, | |||
const double * | cost, | |||
const double * | rowlower, | |||
const double * | rowupper, | |||
const double * | lower, | |||
const double * | upper, | |||
const double * | elemnt, | |||
const int * | row, | |||
const CoinBigIndex * | columnStart, | |||
const int * | length, | |||
int | extraBlock, | |||
int * | rowExtra, | |||
double * | solExtra, | |||
double * | elemExtra, | |||
double * | upperExtra, | |||
double * | costExtra, | |||
double | weight | |||
) | [private] |
int Idiot::cleanIteration | ( | int | iteration, | |
int | ordinaryStart, | |||
int | ordinaryEnd, | |||
double * | colsol, | |||
const double * | lower, | |||
const double * | upper, | |||
const double * | rowLower, | |||
const double * | rowUpper, | |||
const double * | cost, | |||
const double * | element, | |||
double | fixTolerance, | |||
double & | objChange, | |||
double & | infChange | |||
) | [private] |
OsiSolverInterface* Idiot::model_ [private] |
double Idiot::djTolerance_ [private] |
double Idiot::mu_ [private] |
double Idiot::drop_ [private] |
double Idiot::muFactor_ [private] |
double Idiot::stopMu_ [private] |
double Idiot::smallInfeas_ [private] |
double Idiot::reasonableInfeas_ [private] |
double Idiot::exitDrop_ [private] |
double Idiot::muAtExit_ [private] |
double Idiot::exitFeasibility_ [private] |
double Idiot::dropEnoughFeasibility_ [private] |
double Idiot::dropEnoughWeighted_ [private] |
int* Idiot::whenUsed_ [private] |
int Idiot::maxBigIts_ [private] |
int Idiot::maxIts_ [private] |
int Idiot::majorIterations_ [private] |
int Idiot::logLevel_ [private] |
int Idiot::logFreq_ [private] |
int Idiot::checkFrequency_ [private] |
int Idiot::lambdaIterations_ [private] |
int Idiot::maxIts2_ [private] |
int Idiot::strategy_ [private] |
int Idiot::lightWeight_ [private] |