Solver_module.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 LURUPA_SOLVER_MODULE_H
00035 #define LURUPA_SOLVER_MODULE_H
00036 
00037 #include <lurupa/globals.h>
00038 #include <lurupa/Report.h>
00039 #include <Vector.h>
00040 
00041 struct Primal_deflation;
00042 class Lp;
00043 
00049 class Lp_solver {
00050 public:
00051   virtual ~Lp_solver() {};
00052 };
00053 
00061 struct Solver_module_interface {
00063   const char *(*get_version)           ();
00065   void        (*print_version)         ();
00067   void        (*print_brief_version)   ();
00069   bool        (*init)                  (Report *);
00071   void        (*print_options)         ();
00073   bool        (*solve_primal_perturbed)(const Primal_deflation &, Lp *, const int);
00075   bool        (*solve_dual_perturbed)  (const VECTOR &, Lp *, const int);
00077   bool        (*solve_original)        (Lp *, double &);
00079   bool        (*get_dual_ray)          (Lp *, int &);
00081   bool        (*get_primal_ray)        (Lp *, int &);
00083   void        (*set_primal_phase1)     (Lp *);
00085   void        (*set_dual_phase1)       (Lp *);
00087   void        (*restore_primal)        (Lp *);
00089   void        (*restore_dual)          (Lp *);
00091   void        (*restore_primal_phase1) (Lp *);
00093   void        (*restore_dual_phase1)   (Lp *);
00095   bool        (*read_lp)               (Lp *, FILE *, const double, double &);
00096 #if 0
00097   bool        (*set_solution)          (Lp *, void *);
00098 #endif
00099 
00100   bool        (*set_lp)                (Lp *, const double, double &);
00102   bool        (*set_module_options)    (Lp *, int, char *[]);
00104   double      (*get_accuracy)          ();
00106   void        (*lp2solver)             (Lp *);
00108   void        (*set_bounds)            (Lp *, int, double, double);
00109 };
00110 
00119 class Solver_module {
00120 public:
00122   static const char *get_version();
00123 
00125   static void print_version();
00127   static void print_brief_version();
00128 
00130   static bool init(Report *preport);
00131 
00134   static double get_accuracy();
00135 
00137   static bool set_module_options(int argc, char *argv[]);
00138 
00140   static bool read_lp(Lp *lp, FILE *in, const double relative_interval_radius, double &eta);
00144   static void print_options();
00145 
00146 #if 0
00147   static bool set_solution(Lp *lp, void *p);
00148 #endif
00149 
00151   static bool set_lp(Lp *lp, const double relative_interval_radius, double &eta);
00152 
00154   static bool solve_original(Lp *lp, double &optimal_value);
00155 
00157   static bool solve_primal_perturbed(const Primal_deflation &deflation,
00158                                      Lp *lp, const int iteration);
00159 
00161   static bool solve_dual_perturbed(const VECTOR &deflation_c, Lp *lp,
00162                                    const int iteration);
00163 
00165   static bool get_dual_ray(Lp *lp, int &iyzray);
00166 
00168   static bool get_primal_ray(Lp *lp, int &ixray);
00169 
00171   static void set_primal_phase1(Lp *lp);
00172 
00174   static void set_dual_phase1(Lp *lp);
00175 
00177   static void restore_primal(Lp *lp);
00178 
00180   static void restore_dual(Lp *lp);
00181 
00183   static void restore_primal_phase1(Lp *);
00184 
00186   static void restore_dual_phase1(Lp *);
00187 
00189   static void lp2solver(Lp *lp_lurupa);
00190 
00192   static void set_bounds(Lp *lp, int var, double lower, double upper);
00193 
00194 protected:
00195   static Report *preport;  
00197 private:
00198   Solver_module();
00199   ~Solver_module();
00200 }; /* Solver_module */
00201 
00202 extern "C" {
00204   void getFuncPointers(Solver_module_interface &i);
00205 }
00206 
00207 #endif /* ifdef LURUPA_SOLVER_MODULE_H */
00208 

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