Bcp  1.4.4
BCP_warmstart_primaldual.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_WARMSTART_PRIMALDUAL_H
4 #define _BCP_WARMSTART_PRIMALDUAL_H
5 
6 #include "BCP_enum.hpp"
7 #include "BCP_warmstart.hpp"
8 #include "BCP_vector_change.hpp"
9 
10 /* NOTE:
11  Doxygen gracefully generates description for all inherited methods if they
12  are not documented here. So the virtual methods are documented ONLY if they
13  have something additional to say.
14 */
15 
16 //#############################################################################
17 
22 private:
25 
31 
32 private:
34  BCP_vec_change<double> _primal;
39 public:
43  BCP_warmstart_primaldual(BCP_buffer& buf) : _primal(buf), _dual(buf) {}
47  BCP_warmstart_primaldual(const double* pfirst, const double* plast,
48  const double* dfirst, const double* dlast) :
49  _primal(pfirst, plast), _dual(dfirst, dlast) {}
52  _primal(ws._primal), _dual(ws._dual) {}
53 
57  // Inherited methods --------------------------------------------------------
58 
61  virtual CoinWarmStart* convert_to_CoinWarmStart() const;
62 
63  virtual BCP_storage_t storage() const {
64  BCP_storage_t return_matrix[16] = {
67 
70 
73 
76  };
77  int pst = _primal.storage();
78  int dst = _dual.storage();
79  return return_matrix[4*pst + dst];
80  }
81 
82  virtual BCP_warmstart* clone() const {
83  return new BCP_warmstart_primaldual(*this);
84  }
85 
86  virtual BCP_warmstart* empty_wrt_this() const {
87  // The default constructor creates an empty WrtParent warmstart info
88  // (i.e., no change wrt the parent)
89  return new BCP_warmstart_primaldual();
90  }
91 
92  virtual int storage_size() const {
93  return _primal.storage_size() + _dual.storage_size();
94  }
95 
96  virtual void update(const BCP_warmstart* const change);
97 
98  virtual BCP_warmstart* as_change(const BCP_warmstart* const old_ws,
99  const BCP_vec<int>& del_vars,
100  const BCP_vec<int>& del_cuts,
101  const double petol,
102  const double detol) const;
103 
104  // Not inherited methods ----------------------------------------------------
105 
107  void pack(BCP_buffer& buf) const {
108  _primal.pack(buf);
109  _dual.pack(buf);
110  }
111 };
112 
113 #endif
virtual int storage_size() const
Return how much memory it&#39;ll take to pack this warmstart info.
void pack(BCP_buffer &buf) const
Pack the warmstart info into a buffer.
int storage_size() const
Return how much memory it&#39;ll take to pack this info.
BCP_storage_t
This enumerative constant describes how to store certain data for a search tree node.
Definition: BCP_enum.hpp:84
virtual BCP_warmstart * as_change(const BCP_warmstart *const old_ws, const BCP_vec< int > &del_vars, const BCP_vec< int > &del_cuts, const double petol, const double detol) const
Return a pointer to a warmstart info describing the currently stored data as a change with respect to...
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
BCP_warmstart_primaldual(const BCP_warmstart_primaldual &ws)
Copy constructor.
Warmstarting information for the LP solver.
BCP_warmstart_primaldual(BCP_buffer &buf)
Create the object by unpacking it from a buffer.
virtual void update(const BCP_warmstart *const change)
Update the current data with the one in the argument.
void pack(BCP_buffer &buf) const
Pack the data into a buffer.
BCP_warmstart_primaldual(const double *pfirst, const double *plast, const double *dfirst, const double *dlast)
Create an explicitly stored warmstart info by considering the double arrays [fpirst,plast) and [dpirst,dlast) as the primal and dual vectors.
No data is stored.
Definition: BCP_enum.hpp:86
virtual BCP_storage_t storage() const
Return how the warmstarting info is stored.
virtual CoinWarmStart * convert_to_CoinWarmStart() const
Return an CoinWarmStart object that can be fed to the LP engine.
The data stored is with respect to the same kind of data in the parent of the search tree node...
Definition: BCP_enum.hpp:91
virtual BCP_warmstart * empty_wrt_this() const
Create a warmstart info describing that no change should be done.
The data stored is an explicit listing of values.
Definition: BCP_enum.hpp:88
BCP_storage_t storage() const
Return the storage type of the vector.
This class describes a warmstart information that consists solely of the dual vector.
virtual BCP_warmstart * clone() const
Make a replica of the current warmstart information.