Sm_lps3_2.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_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 /* ifdef SM_lps3_2_H */

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