00001
00002
00003
00004
00005
00006
00007 #ifndef Idiot_H
00008 #define Idiot_H
00009 #ifndef OSI_IDIOT
00010 #include "ClpSimplex.hpp"
00011 #define OsiSolverInterface ClpSimplex
00012 #else
00013 #include "OsiSolverInterface.hpp"
00014 typedef int CoinBigIndex;
00015 #endif
00016 class CoinMessageHandler;
00017 class CoinMessages;
00019 typedef struct {
00020 double infeas;
00021 double objval;
00022 double dropThis;
00023 double weighted;
00024 double sumSquared;
00025 double djAtBeginning;
00026 double djAtEnd;
00027 int iteration;
00028 } IdiotResult;
00045 class Idiot {
00046
00047 public:
00048
00053
00054 Idiot ( );
00056 Idiot ( OsiSolverInterface & model );
00057
00059 Idiot(const Idiot &);
00061 Idiot & operator=(const Idiot & rhs);
00063 ~Idiot ( );
00065
00066
00070
00071 void solve();
00073 void crash(int numberPass,CoinMessageHandler * handler ,const CoinMessages * messages);
00083 void crossOver(int mode);
00085
00086
00092 inline double getStartingWeight() const
00093 { return mu_;}
00094 inline void setStartingWeight(double value)
00095 { mu_ = value;}
00098 inline double getWeightFactor() const
00099 { return muFactor_;}
00100 inline void setWeightFactor(double value)
00101 { muFactor_ = value;}
00105 inline double getFeasibilityTolerance() const
00106 { return smallInfeas_;}
00107 inline void setFeasibilityTolerance(double value)
00108 { smallInfeas_ = value;}
00112 inline double getReasonablyFeasible() const
00113 { return reasonableInfeas_;}
00114 inline void setReasonablyFeasible(double value)
00115 { reasonableInfeas_ = value;}
00118 inline double getExitInfeasibility() const
00119 { return exitFeasibility_;}
00120 inline void setExitInfeasibility(double value)
00121 { exitFeasibility_ = value;}
00124 inline int getMajorIterations() const
00125 { return majorIterations_;}
00126 inline void setMajorIterations(int value)
00127 { majorIterations_ = value;}
00134 inline int getMinorIterations() const
00135 { return maxIts2_;}
00136 inline void setMinorIterations(int value)
00137 { maxIts2_ = value;}
00138
00139 inline int getMinorIterations0() const
00140 { return maxIts_;}
00141 inline void setMinorIterations0(int value)
00142 { maxIts_ = value;}
00146 inline int getReduceIterations() const
00147 { return maxBigIts_;}
00148 inline void setReduceIterations(int value)
00149 { maxBigIts_ = value;}
00151 inline int getLogLevel() const
00152 { return logLevel_;}
00153 inline void setLogLevel(int value)
00154 { logLevel_ = value;}
00156 inline int getLightweight() const
00157 { return lightWeight_;}
00158 inline void setLightweight(int value)
00159 { lightWeight_ = value;}
00161 inline int getStrategy() const
00162 { return strategy_;}
00163 inline void setStrategy(int value)
00164 { strategy_ = value;}
00166 inline double getDropEnoughFeasibility() const
00167 { return dropEnoughFeasibility_;}
00168 inline void setDropEnoughFeasibility(double value)
00169 { dropEnoughFeasibility_=value;}
00171 inline double getDropEnoughWeighted() const
00172 { return dropEnoughWeighted_;}
00173 inline void setDropEnoughWeighted(double value)
00174 { dropEnoughWeighted_=value;}
00176
00177
00179 private:
00180
00182
00183 public:
00184 void solve2(CoinMessageHandler * handler,const CoinMessages *messages);
00185 private:
00186 IdiotResult IdiSolve(
00187 int nrows, int ncols, double * rowsol , double * colsol,
00188 double * pi, double * djs, const double * origcost ,
00189 double * rowlower,
00190 double * rowupper, const double * lower,
00191 const double * upper, const double * element,
00192 const int * row, const CoinBigIndex * colcc,
00193 const int * length, double * lambda,
00194 int maxIts,double mu,double drop,
00195 double maxmin, double offset,
00196 int strategy,double djTol,double djExit,double djFlag,
00197 CoinThreadRandom * randomNumberGenerator);
00198 int dropping(IdiotResult result,
00199 double tolerance,
00200 double small,
00201 int *nbad);
00202 IdiotResult objval(int nrows, int ncols, double * rowsol , double * colsol,
00203 double * pi, double * djs, const double * cost ,
00204 const double * rowlower,
00205 const double * rowupper, const double * lower,
00206 const double * upper, const double * elemnt,
00207 const int * row, const CoinBigIndex * columnStart,
00208 const int * length, int extraBlock, int * rowExtra,
00209 double * solExtra, double * elemExtra, double * upperExtra,
00210 double * costExtra,double weight);
00211
00212 int cleanIteration(int iteration, int ordinaryStart, int ordinaryEnd,
00213 double * colsol, const double * lower, const double * upper,
00214 const double * rowLower, const double * rowUpper,
00215 const double * cost, const double * element, double fixTolerance,double & objChange,
00216 double & infChange);
00217 private:
00219 OsiSolverInterface * model_;
00220
00221 double djTolerance_;
00222 double mu_;
00223 double drop_;
00224 double muFactor_;
00225 double stopMu_;
00226 double smallInfeas_;
00227 double reasonableInfeas_;
00228 double exitDrop_;
00229 double muAtExit_;
00230 double exitFeasibility_;
00231 double dropEnoughFeasibility_;
00232 double dropEnoughWeighted_;
00233 int * whenUsed_;
00234 int maxBigIts_;
00235 int maxIts_;
00236 int majorIterations_;
00237 int logLevel_;
00238 int logFreq_;
00239 int checkFrequency_;
00240 int lambdaIterations_;
00241 int maxIts2_;
00242 int strategy_;
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 int lightWeight_;
00255 };
00256 #endif