00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00034 #ifndef SM_LPS3_2_H
00035 #define SM_LPS3_2_H
00036
00037 #include <lurupa/Solver_module.h>
00038 #include <lpkit.h>
00039
00047 class Lp_lp_solve : public Lp_solver {
00048 public:
00049 Lp_lp_solve();
00050 ~Lp_lp_solve();
00051
00052 lprec *lp;
00053 int *mp_eq_con;
00054 int *mp_le_con;
00055 int *mp_parts;
00056 };
00057
00059 extern "C" void get_func_pointers(Solver_module_interface &i);
00060
00066 class Sm_lps3_2 : public Solver_module {
00067 public:
00069 static const char *get_version();
00070
00072 static void print_version();
00074 static void print_brief_version();
00075
00077 static bool init(Report *report);
00078
00080 static double get_accuracy();
00081
00083 static void print_options();
00084
00086 static bool read_lp(Lp *lp, FILE *in, const double relative_interval_radius, double &eta);
00087
00089 static bool set_lp(Lp *lp, const double relative_interval_radius, double &eta);
00090
00092 static bool solve_original(Lp *lp, double &optimal_value);
00093
00095 static bool solve_primal_perturbed(const Primal_deflation &deflation, Lp *lp,
00096 const int iteration);
00097
00099 static bool solve_dual_perturbed(const VECTOR &deflation_c, Lp *lp, const int iteration);
00100
00102 static void restore_primal(Lp *lp);
00103
00105 static void restore_dual(Lp *lp);
00106
00107 private:
00115 static void read_general_data(Lp *lp);
00116
00118 static bool build_constraint_maps(int &c_eq, int &c_le, const int rows, const int cols, Lp *lp);
00119
00121 static void find_free_variables(int &vars, Lp *lp);
00122
00124 static void resize_lp(Lp *lp, const int cols, const int c_eq, const int c_le);
00125
00127 static void read_lp_mat(const int rows, Lp *lp);
00128
00130 static void read_right_hand_sides(Lp *lp);
00131
00133 static void read_simple_bounds(Lp *lp, const int rows);
00134
00136 static void adjust_eta(double &eta, const Lp *lp);
00137
00139 static void inflate_lp(Lp *lp, const double r);
00140
00142 static bool transform_lp(Lp *lp, const double relative_interval_radius, double &eta);
00146 static bool solve_lp(Lp *lp);
00147
00149 static void read_primals(Lp *lp, const int rows);
00150
00152 static void read_duals(Lp *lp);
00153
00155 static void primal_perturb(const Primal_deflation &d, const Lp *lp);
00156
00158 static void dual_perturb(const VECTOR &d_c, const Lp *lp);
00159
00160
00161
00162 Sm_lps3_2();
00163 ~Sm_lps3_2();
00164 };
00165
00166 #endif