00001 /* 00002 Copyright (C) 2000, International Business Machines 00003 Corporation and others. All Rights Reserved. 00004 This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 $Id$ 00007 */ 00008 00009 #ifndef __LP_H__ 00010 #define __LP_H__ 00011 00012 #include <cfloat> 00013 #include <string> 00014 #include <fstream> 00015 00016 #include "VolVolume.hpp" 00017 #include "lpc.h" 00018 00019 using std::string; 00020 00021 //############################################################################# 00022 00023 // parameters controlled by the user 00024 class LP_parms { 00025 public: 00026 string fdata; // file with the data 00027 string dualfile; // file with an initial dual solution 00028 string dual_savefile; // file to save final dual solution 00029 string primal_savefile; // file to save primal integer solution 00030 int h_iter; // number of times that the primal heuristic will be run 00031 // after termination of the volume algorithm 00032 double var_ub; // upper bound for the variables 00033 00034 LP_parms(const char* filename); 00035 ~LP_parms() {} 00036 }; 00037 00038 //############################################################################# 00039 00040 class LP_data_and_hook : public VOL_user_hooks { // original data for LP 00041 public: 00042 VOL_lp lp_pb; // lp data 00043 VOL_dvector rhs; // right hand side 00044 VOL_ivector ix; // best integer feasible solution so far 00045 double icost; // value of best integer feasible solution 00046 public: 00047 LP_data_and_hook() : icost(DBL_MAX) {} 00048 virtual ~LP_data_and_hook() {} 00049 00050 public: 00051 // for all hooks: return value of -1 means that volume should quit 00052 // compute reduced costs 00053 int compute_rc(const VOL_dvector& u, VOL_dvector& rc); 00054 // solve relaxed problem 00055 int solve_subproblem(const VOL_dvector& u, const VOL_dvector& rc, 00056 double& lcost, VOL_dvector& x, VOL_dvector&v, 00057 double& pcost); 00058 // primal heuristic 00059 // return DBL_MAX in heur_val if feas sol wasn't/was found 00060 int heuristics(const VOL_problem& p, 00061 const VOL_dvector& x, double& heur_val); 00062 }; 00063 00064 //############################################################################# 00065 00066 #endif