Loading...
Searching...
No Matches
Idiot Class Reference

This class implements a very silly algorithm. More...

`#include <Idiot.hpp>`

## Public Member Functions

Constructors and destructor
Just a pointer to model is kept
| 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, bool doCrossover=true)
| 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.

## Gets and sets of most useful data

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_
double | getStartingWeight () const
| Starting weight - small emphasizes feasibility, default 1.0e-4.
void | setStartingWeight (double value)
double | getWeightFactor () const
| Weight factor - weight multiplied by this when changes, default 0.333.
void | setWeightFactor (double value)
double | getFeasibilityTolerance () const
| Feasibility tolerance - problem essentially feasible if individual infeasibilities less than this.
void | setFeasibilityTolerance (double value)
double | getReasonablyFeasible () const
| Reasonably feasible.
void | setReasonablyFeasible (double value)
double | getExitInfeasibility () const
| Exit infeasibility - exit if sum of infeasibilities less than this.
void | setExitInfeasibility (double value)
int | getMajorIterations () const
| Major iterations.
void | setMajorIterations (int value)
int | getMinorIterations () const
| Minor iterations.
void | setMinorIterations (int value)
int | getMinorIterations0 () const
void | setMinorIterations0 (int value)
int | getReduceIterations () const
| Reduce weight after this many major iterations.
void | setReduceIterations (int value)
int | getLogLevel () const
| Amount of information - default of 1 should be okay.
void | setLogLevel (int value)
int | getLightweight () const
| How lightweight - 0 not, 1 yes, 2 very lightweight.
void | setLightweight (int value)
int | getStrategy () const
| strategy
void | setStrategy (int value)
double | getDropEnoughFeasibility () const
| Fine tuning - okay if feasibility drop this factor.
void | setDropEnoughFeasibility (double value)
double | getDropEnoughWeighted () const
| Fine tuning - okay if weighted obj drop this factor.
void | setDropEnoughWeighted (double value)
void | setModel (OsiSolverInterface *model)
| Set model.
void | solve2 (CoinMessageHandler *handler, const CoinMessages *messages)
| Stuff for internal use.

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, double &maxInfeasibility)

## Detailed Description

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 48 of file Idiot.hpp.

## Constructor & Destructor Documentation

## Idiot() [1/3]

Idiot::Idiot | ( |  | ) |

Default constructor.

## Idiot() [2/3]

Idiot::Idiot | ( | OsiSolverInterface & | model | ) |

Constructor with model.

## Idiot() [3/3]

Idiot::Idiot | ( | const Idiot & |  | ) |

Copy constructor.

## ~Idiot()

Idiot::~Idiot | ( |  | ) |

Destructor.

## Member Function Documentation

## operator=()

Idiot & Idiot::operator= | ( | const Idiot & | rhs | ) |

Assignment operator. This copies the data.

## solve()

void Idiot::solve | ( |  | ) |

Get an approximate solution with the idiot code.

## crash()

void Idiot::crash | ( | int | numberPass,
|  | CoinMessageHandler * | handler,
|  | const CoinMessages * | messages,
|  | bool | doCrossover = true )

Lightweight "crash".

## crossOver()

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

## getStartingWeight()

double Idiot::getStartingWeight | ( |  | ) | const

inline

Starting weight - small emphasizes feasibility, default 1.0e-4.

Definition at line 93 of file Idiot.hpp.

## setStartingWeight()

void Idiot::setStartingWeight | ( | double | value | ) |

inline

Definition at line 97 of file Idiot.hpp.

## getWeightFactor()

double Idiot::getWeightFactor | ( |  | ) | const

inline

Weight factor - weight multiplied by this when changes, default 0.333.

Definition at line 103 of file Idiot.hpp.

## setWeightFactor()

void Idiot::setWeightFactor | ( | double | value | ) |

inline

Definition at line 107 of file Idiot.hpp.

## getFeasibilityTolerance()

double Idiot::getFeasibilityTolerance | ( |  | ) | const

inline

Feasibility tolerance - problem essentially feasible if individual infeasibilities less than this.

default 0.1

Definition at line 114 of file Idiot.hpp.

## setFeasibilityTolerance()

void Idiot::setFeasibilityTolerance | ( | double | value | ) |

inline

Definition at line 118 of file Idiot.hpp.

## getReasonablyFeasible()

double Idiot::getReasonablyFeasible | ( |  | ) | const

inline

Reasonably feasible.

Dubious method concentrates more on objective when sum of infeasibilities less than this. Very dubious default value of (Number of rows)/20

Definition at line 125 of file Idiot.hpp.

## setReasonablyFeasible()

void Idiot::setReasonablyFeasible | ( | double | value | ) |

inline

Definition at line 129 of file Idiot.hpp.

## getExitInfeasibility()

double Idiot::getExitInfeasibility | ( |  | ) | const

inline

Exit infeasibility - exit if sum of infeasibilities less than this.

Default -1.0 (i.e. switched off)

Definition at line 135 of file Idiot.hpp.

## setExitInfeasibility()

void Idiot::setExitInfeasibility | ( | double | value | ) |

inline

Definition at line 139 of file Idiot.hpp.

## getMajorIterations()

int Idiot::getMajorIterations | ( |  | ) | const

inline

Major iterations.

stop after this number. Default 30. Use 2-5 for "crash" 50-100 for serious crunching

Definition at line 145 of file Idiot.hpp.

## setMajorIterations()

void Idiot::setMajorIterations | ( | int | value | ) |

inline

Definition at line 149 of file Idiot.hpp.

## getMinorIterations()

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)

Definition at line 159 of file Idiot.hpp.

## setMinorIterations()

void Idiot::setMinorIterations | ( | int | value | ) |

inline

Definition at line 163 of file Idiot.hpp.

## getMinorIterations0()

int Idiot::getMinorIterations0 | ( |  | ) | const

inline

Definition at line 168 of file Idiot.hpp.

## setMinorIterations0()

void Idiot::setMinorIterations0 | ( | int | value | ) |

inline

Definition at line 172 of file Idiot.hpp.

## getReduceIterations()

int Idiot::getReduceIterations | ( |  | ) | const

inline

Reduce weight after this many major iterations.

It may get reduced before this but this is a maximum. Default 3. 3-10 plausible.

Definition at line 179 of file Idiot.hpp.

## setReduceIterations()

void Idiot::setReduceIterations | ( | int | value | ) |

inline

Definition at line 183 of file Idiot.hpp.

## getLogLevel()

int Idiot::getLogLevel | ( |  | ) | const

inline

Amount of information - default of 1 should be okay.

Definition at line 188 of file Idiot.hpp.

## setLogLevel()

void Idiot::setLogLevel | ( | int | value | ) |

inline

Definition at line 192 of file Idiot.hpp.

## getLightweight()

int Idiot::getLightweight | ( |  | ) | const

inline

How lightweight - 0 not, 1 yes, 2 very lightweight.

Definition at line 197 of file Idiot.hpp.

## setLightweight()

void Idiot::setLightweight | ( | int | value | ) |

inline

Definition at line 201 of file Idiot.hpp.

## getStrategy()

int Idiot::getStrategy | ( |  | ) | const

inline

strategy

Definition at line 206 of file Idiot.hpp.

## setStrategy()

void Idiot::setStrategy | ( | int | value | ) |

inline

Definition at line 210 of file Idiot.hpp.

## getDropEnoughFeasibility()

double Idiot::getDropEnoughFeasibility | ( |  | ) | const

inline

Fine tuning - okay if feasibility drop this factor.

Definition at line 215 of file Idiot.hpp.

## setDropEnoughFeasibility()

void Idiot::setDropEnoughFeasibility | ( | double | value | ) |

inline

Definition at line 219 of file Idiot.hpp.

## getDropEnoughWeighted()

double Idiot::getDropEnoughWeighted | ( |  | ) | const

inline

Fine tuning - okay if weighted obj drop this factor.

Definition at line 224 of file Idiot.hpp.

## setDropEnoughWeighted()

void Idiot::setDropEnoughWeighted | ( | double | value | ) |

inline

Definition at line 228 of file Idiot.hpp.

## setModel()

void Idiot::setModel | ( | OsiSolverInterface * | model | ) |

inline

Set model.

Definition at line 233 of file Idiot.hpp.

## solve2()

void Idiot::solve2 | ( | CoinMessageHandler * | handler,
|  | const CoinMessages * | messages )

Stuff for internal use.

Does actual work

## IdiSolve()

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

## dropping()

int Idiot::dropping | ( | IdiotResult | result,
|  | double | tolerance,
|  | double | small,
|  | int * | nbad )

private

## objval()

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

## cleanIteration()

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,
|  | double & | maxInfeasibility )

private

## Member Data Documentation

## model_

OsiSolverInterface* Idiot::model_

private

Underlying model.

Definition at line 281 of file Idiot.hpp.

## djTolerance_

double Idiot::djTolerance_

private

Definition at line 283 of file Idiot.hpp.

## mu_

double Idiot::mu_

private

Definition at line 284 of file Idiot.hpp.

## drop_

double Idiot::drop_

private

Definition at line 285 of file Idiot.hpp.

## muFactor_

double Idiot::muFactor_

private

Definition at line 286 of file Idiot.hpp.

## stopMu_

double Idiot::stopMu_

private

Definition at line 287 of file Idiot.hpp.

## smallInfeas_

double Idiot::smallInfeas_

private

Definition at line 288 of file Idiot.hpp.

## reasonableInfeas_

double Idiot::reasonableInfeas_

private

Definition at line 289 of file Idiot.hpp.

## exitDrop_

double Idiot::exitDrop_

private

Definition at line 290 of file Idiot.hpp.

## muAtExit_

double Idiot::muAtExit_

private

Definition at line 291 of file Idiot.hpp.

## exitFeasibility_

double Idiot::exitFeasibility_

private

Definition at line 292 of file Idiot.hpp.

## dropEnoughFeasibility_

double Idiot::dropEnoughFeasibility_

private

Definition at line 293 of file Idiot.hpp.

## dropEnoughWeighted_

double Idiot::dropEnoughWeighted_

private

Definition at line 294 of file Idiot.hpp.

## whenUsed_

int* Idiot::whenUsed_

private

Definition at line 295 of file Idiot.hpp.

## maxBigIts_

int Idiot::maxBigIts_

private

Definition at line 296 of file Idiot.hpp.

## maxIts_

int Idiot::maxIts_

private

Definition at line 297 of file Idiot.hpp.

## majorIterations_

int Idiot::majorIterations_

private

Definition at line 298 of file Idiot.hpp.

## logLevel_

int Idiot::logLevel_

private

Definition at line 299 of file Idiot.hpp.

## logFreq_

int Idiot::logFreq_

private

Definition at line 300 of file Idiot.hpp.

## checkFrequency_

int Idiot::checkFrequency_

private

Definition at line 301 of file Idiot.hpp.

## lambdaIterations_

int Idiot::lambdaIterations_

private

Definition at line 302 of file Idiot.hpp.

## maxIts2_

int Idiot::maxIts2_

private

Definition at line 303 of file Idiot.hpp.

## strategy_

int Idiot::strategy_

private

Definition at line 304 of file Idiot.hpp.

## lightWeight_

int Idiot::lightWeight_

private

Definition at line 322 of file Idiot.hpp.

The documentation for this class was generated from the following file:

- Clp/src/Idiot.hpp