Vol  1.5.4
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros
lp.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000, International Business Machines
3  Corporation and others. All Rights Reserved.
4  This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6  $Id$
7 */
8 
9 #ifndef __LP_H__
10 #define __LP_H__
11 
12 #include <cfloat>
13 #include <string>
14 #include <fstream>
15 
16 #include "VolVolume.hpp"
17 #include "lpc.h"
18 
19 using std::string;
20 
21 //#############################################################################
22 
23 // parameters controlled by the user
24 class LP_parms {
25 public:
26  string fdata; // file with the data
27  string dualfile; // file with an initial dual solution
28  string dual_savefile; // file to save final dual solution
29  string primal_savefile; // file to save primal integer solution
30  int h_iter; // number of times that the primal heuristic will be run
31  // after termination of the volume algorithm
32  double var_ub; // upper bound for the variables
33 
34  LP_parms(const char* filename);
35  ~LP_parms() {}
36 };
37 
38 //#############################################################################
39 
40 class LP_data_and_hook : public VOL_user_hooks { // original data for LP
41 public:
42  VOL_lp lp_pb; // lp data
43  VOL_dvector rhs; // right hand side
44  VOL_ivector ix; // best integer feasible solution so far
45  double icost; // value of best integer feasible solution
46 public:
47  LP_data_and_hook() : icost(DBL_MAX) {}
48  virtual ~LP_data_and_hook() {}
49 
50  public:
51  // for all hooks: return value of -1 means that volume should quit
52  // compute reduced costs
53  int compute_rc(const VOL_dvector& u, VOL_dvector& rc);
54  // solve relaxed problem
55  int solve_subproblem(const VOL_dvector& u, const VOL_dvector& rc,
56  double& lcost, VOL_dvector& x, VOL_dvector&v,
57  double& pcost);
58  // primal heuristic
59  // return DBL_MAX in heur_val if feas sol wasn't/was found
60  int heuristics(const VOL_problem& p,
61  const VOL_dvector& x, double& heur_val);
62 };
63 
64 //#############################################################################
65 
66 #endif
int h_iter
Definition: lp.h:30
The user hooks should be overridden by the user to provide the problem specific routines for the volu...
Definition: VolVolume.hpp:563
double var_ub
Definition: lp.h:32
string dualfile
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.
~LP_parms()
Definition: lp.h:35
This class holds every data for the Volume Algorithm and its solve method must be invoked to solve th...
Definition: VolVolume.hpp:605
string primal_savefile
Definition: lp.h:29
Definition: lp.h:24
string fdata
Definition: lp.h:26
int compute_rc(const VOL_dvector &u, VOL_dvector &rc)
compute reduced costs
LP_parms(const char *filename)
VOL_lp lp_pb
Definition: lp.h:42
string dual_savefile
Definition: lp.h:28
VOL_ivector ix
Definition: lp.h:44
virtual ~LP_data_and_hook()
Definition: lp.h:48
double icost
Definition: lp.h:45
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.
VOL_dvector rhs
Definition: lp.h:43
LP_data_and_hook()
Definition: lp.h:47
vector of ints.
Definition: VolVolume.hpp:242
vector of doubles.
Definition: VolVolume.hpp:148
Definition: lpc.h:17