Sm_lps4_0_1_0.h

Go to the documentation of this file.
00001 /*
00002  * Lurupa, a library for verified linear programming.
00003  * Copyright (C) 2006 by Christian Keil
00004  *
00005  * This file is part of Lurupa.
00006  *
00007  * Lurupa is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
00020  * USA
00021  */
00022 
00034 #ifndef SM_LPS4_0_1_0_H
00035 #define SM_LPS4_0_1_0_H
00036 
00037 #include <lurupa/Solver_module.h>
00038 #include <lpkit.h>
00039 /* lp_solve's definition of UNKNOWN clashes with libtool */
00040 #undef UNKNOWN
00041 
00049 class Lp_lp_solve : public Lp_solver {
00050 public:
00051   Lp_lp_solve();
00052   ~Lp_lp_solve();
00053 
00054   lprec *lp;       
00055   int *mp_eq_con;  
00056   int *mp_le_con;  
00057 };
00058 
00060 extern "C" void get_func_pointers(Solver_module_interface &i);
00061 
00067 class Sm_lps4_0_1_0 : public Solver_module {
00068 public:
00070   static const char *get_version();
00071 
00073   static void print_version();
00075   static void print_brief_version();
00076 
00078   static bool init(Report *report);
00079 
00081   static double get_accuracy();
00082 
00084   static void print_options();
00085 
00087   static bool set_module_options(Lp *lp, int argc, char *argv[]);
00088 
00090   static bool read_lp(Lp *lp, FILE *in, const double relative_interval_radius, double &eta);
00091 
00093   static bool set_lp(Lp *lp, const double relative_interval_radius, double &eta);
00094 
00096   static bool solve_original(Lp *lp, double &optimal_value);
00097 
00099   static bool solve_primal_perturbed(const Primal_deflation &deflation, Lp *lp, 
00100                                      const int iteration);
00101 
00103   static bool solve_dual_perturbed(const VECTOR &deflation_c, Lp *lp, const int iteration);
00104 
00106   static void restore_primal(Lp *lp);
00107 
00109   static void restore_dual(Lp *lp);
00110 
00111 private:
00113   static void WINAPI lps_log(void *lp, void *userhandle, char *buf);
00114 
00122   static void read_general_data(Lp *lp);
00123 
00125   static bool build_constraint_maps(int &c_eq, int &c_le, const int rows, const int cols, Lp *lp);
00126 
00128   static void find_free_variables(const int vars, Lp *lp);
00129 
00131   static void resize_lp(Lp *lp, const int cols, const int c_eq, const int c_le);
00132 
00134   static void read_lp_mat(const int rows, Lp *lp);
00135 
00137   static void read_right_hand_sides(Lp *lp);
00138 
00140   static void read_simple_bounds(Lp *lp);
00141 
00143   static void adjust_eta(double &eta, const Lp *lp);
00144 
00146   static void inflate_lp(Lp *lp, const double r);
00147 
00149   static bool transform_lp(Lp *lp, const double relative_interval_radius, double &eta);
00154   static void postprocess(Lp *lp, const int status);
00155 
00157   static bool solve_lp(Lp *lp);
00158 
00160   static bool read_primals(Lp *lp, const int cols);
00161 
00163   static bool read_duals(Lp *lp);
00164 
00166   static void primal_perturb(const Primal_deflation &d, const Lp *lp);
00167 
00169   static void dual_perturb(const VECTOR &d_c, const Lp *lp);
00170 
00171   Sm_lps4_0_1_0();
00172   ~Sm_lps4_0_1_0();
00173 };
00174 
00175 #endif /* ifdef SM_LPS4_0_1_0_H */

Generated on Thu Jun 26 18:08:52 2008 for Lurupa by  doxygen 1.5.6