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;
00018
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;};
00141 inline int getReduceIterations() const
00142 { return maxBigIts_;};
00143 inline void setReduceIterations(int value)
00144 { maxBigIts_ = value;};
00146 inline int getLogLevel() const
00147 { return logLevel_;};
00148 inline void setLogLevel(int value)
00149 { logLevel_ = value;};
00151 inline int getLightweight() const
00152 { return lightWeight_;};
00153 inline void setLightweight(int value)
00154 { lightWeight_ = value;};
00156 inline int getStrategy() const
00157 { return strategy_;};
00158 inline void setStrategy(int value)
00159 { strategy_ = value;};
00161 inline double getDropEnoughFeasibility() const
00162 { return dropEnoughFeasibility_;};
00163 inline void setDropEnoughFeasibility(double value)
00164 { dropEnoughFeasibility_=value;};
00166 inline double getDropEnoughWeighted() const
00167 { return dropEnoughWeighted_;};
00168 inline void setDropEnoughWeighted(double value)
00169 { dropEnoughWeighted_=value;};
00171
00172
00174 private:
00175
00177 void solve2(CoinMessageHandler * handler,const CoinMessages *messages);
00178 IdiotResult IdiSolve(
00179 int nrows, int ncols, double * rowsol , double * colsol,
00180 double * pi, double * djs, const double * origcost ,
00181 const double * rowlower,
00182 double * rowupper, const double * lower,
00183 const double * upper, const double * element,
00184 const int * row, const CoinBigIndex * colcc,
00185 const int * length, double * lambda,
00186 int maxIts,double mu,double drop,
00187 double maxmin, double offset,
00188 int strategy,double djTol,double djExit,double djFlag);
00189 int dropping(IdiotResult result,
00190 double tolerance,
00191 double small,
00192 int *nbad);
00193 IdiotResult objval(int nrows, int ncols, double * rowsol , double * colsol,
00194 double * pi, double * djs, const double * cost ,
00195 const double * rowlower,
00196 const double * rowupper, const double * lower,
00197 const double * upper, const double * elemnt,
00198 const int * row, const CoinBigIndex * columnStart,
00199 const int * length, int extraBlock, int * rowExtra,
00200 double * solExtra, double * elemExtra, double * upperExtra,
00201 double * costExtra,double weight);
00202
00203 private:
00205 OsiSolverInterface * model_;
00206
00207 double djTolerance_;
00208 double mu_;
00209 double drop_;
00210 double muFactor_;
00211 double stopMu_;
00212 double smallInfeas_;
00213 double reasonableInfeas_;
00214 double exitDrop_;
00215 double muAtExit_;
00216 double exitFeasibility_;
00217 double dropEnoughFeasibility_;
00218 double dropEnoughWeighted_;
00219 int * whenUsed_;
00220 int maxBigIts_;
00221 int maxIts_;
00222 int majorIterations_;
00223 int logLevel_;
00224 int logFreq_;
00225 int checkFrequency_;
00226 int lambdaIterations_;
00227 int maxIts2_;
00228 int strategy_;
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 int lightWeight_;
00239 };
00240 #endif