lp.h
Go to the documentation of this file.
1 #ifndef __LP_H__
2 #define __LP_H__
3 
4 #include <cfloat>
5 #include <string>
6 #include <fstream>
7 
8 #include "VolVolume.hpp"
9 #include "lpc.h"
10 
11 using std::string;
12 
13 //#############################################################################
14 
15 // parameters controlled by the user
16 class LP_parms {
17 public:
18  string fdata; // file with the data
19  string dualfile; // file with an initial dual solution
20  string dual_savefile; // file to save final dual solution
21  string primal_savefile; // file to save primal integer solution
22  int h_iter; // number of times that the primal heuristic will be run
23  // after termination of the volume algorithm
24  double var_ub; // upper bound for the variables
25 
26  LP_parms(const char* filename);
27  ~LP_parms() {}
28 };
29 
30 //#############################################################################
31 
32 class LP_data_and_hook : public VOL_user_hooks { // original data for LP
33 public:
34  VOL_lp lp_pb; // lp data
35  VOL_dvector rhs; // right hand side
36  VOL_ivector ix; // best integer feasible solution so far
37  double icost; // value of best integer feasible solution
38 public:
39  LP_data_and_hook() : icost(DBL_MAX) {}
40  virtual ~LP_data_and_hook() {}
41 
42  public:
43  // for all hooks: return value of -1 means that volume should quit
44  // compute reduced costs
45  int compute_rc(const VOL_dvector& u, VOL_dvector& rc);
46  // solve relaxed problem
47  int solve_subproblem(const VOL_dvector& u, const VOL_dvector& rc,
48  double& lcost, VOL_dvector& x, VOL_dvector&v,
49  double& pcost);
50  // primal heuristic
51  // return DBL_MAX in heur_val if feas sol wasn't/was found
52  int heuristics(const VOL_problem& p,
53  const VOL_dvector& x, double& heur_val);
54 };
55 
56 //#############################################################################
57 
58 #endif
Definition: lpc.h:9
LP_data_and_hook()
Definition: lp.h:39
vector of ints.
Definition: VolVolume.hpp:237
string fdata
Definition: lp.h:18
VOL_lp lp_pb
Definition: lp.h:34
string dual_savefile
Definition: lp.h:20
VOL_dvector rhs
Definition: lp.h:35
vector of doubles.
Definition: VolVolume.hpp:143
~LP_parms()
Definition: lp.h:27
int heuristics(const VOL_problem &p, const VOL_dvector &x, double &heur_val)
Starting from the primal vector x, run a heuristic to produce an integer solution.
This class holds every data for the Volume Algorithm and its solve method must be invoked to solve th...
Definition: VolVolume.hpp:600
double var_ub
Definition: lp.h:24
LP_parms(const char *filename)
int solve_subproblem(const VOL_dvector &u, const VOL_dvector &rc, double &lcost, VOL_dvector &x, VOL_dvector &v, double &pcost)
Solve the subproblem for the subgradient step.
int h_iter
Definition: lp.h:22
int compute_rc(const VOL_dvector &u, VOL_dvector &rc)
compute reduced costs
string dualfile
Definition: lp.h:19
virtual ~LP_data_and_hook()
Definition: lp.h:40
double icost
Definition: lp.h:37
The user hooks should be overridden by the user to provide the problem specific routines for the volu...
Definition: VolVolume.hpp:558
string primal_savefile
Definition: lp.h:21
VOL_ivector ix
Definition: lp.h:36
Definition: lp.h:16