BCP_warmstart_dual.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #include "CoinWarmStartDual.hpp"
4 #include "BCP_warmstart_dual.hpp"
5 
6 //#############################################################################
7 
8 CoinWarmStart*
10 {
12  return NULL;
13 
14  const BCP_vec<double>& dual = _dual.explicit_vector();
15  return new CoinWarmStartDual(dual.size(), dual.begin());
16 }
17 
18 //#############################################################################
19 
20 void
22 {
23  const BCP_warmstart_dual* const dch =
24  dynamic_cast<const BCP_warmstart_dual* const>(change);
25  if (!dch)
26  throw BCP_fatal_error("BCP_warmstart_dual::update\n \
27 Trying to update a BCP_warmstart_dual with a different warmstart!\n");
28 
29  _dual.update(dch->_dual);
30 }
31 
32 
33 //#############################################################################
34 
37  const BCP_vec<int>& del_vars,
38  const BCP_vec<int>& del_cuts,
39  const double petol,
40  const double detol) const
41 {
42  const BCP_warmstart_dual* const ows =
43  dynamic_cast<const BCP_warmstart_dual* const>(old_ws);
44  if (!ows)
45  throw BCP_fatal_error("\
46 Trying to describe a BCP_warmstart_dual as a change to a different ws!\n");
47 
49  throw BCP_fatal_error("\
50 BCP_warmstart_dual::as_change : current data is not explicit!\n");
51 
52  if (ows->storage() == BCP_Storage_WrtParent)
53  throw BCP_fatal_error("\
54 BCP_warmstart_dual::as_change : old_ws is WrtParent!\n");
55 
56  if (ows->storage() == BCP_Storage_NoData)
57  return new BCP_warmstart_dual(*this);
58 
59  // Both are explicit
61  new (&ws->_dual) BCP_vec_change<double>(ows->_dual, _dual, del_cuts, 1e-4);
62  if (ws->_dual.storage_size() >= _dual.storage_size())
63  ws->_dual = _dual;
64 
65  return ws;
66 }
This class describes a warmstart information that consists solely of the dual vector.
virtual void update(const BCP_warmstart *const change)
Update the current data with the one in the argument.
int storage_size() const
Return how much memory it&#39;ll take to pack this info.
const BCP_vec< T > & explicit_vector() const
Return a const reference to the vector if it is explicitly stored, otherwise throw an exception...
No data is stored.
Definition: BCP_enum.hpp:86
iterator begin()
Return an iterator to the beginning of the object.
Definition: BCP_vector.hpp:99
Warmstarting information for the LP solver.
The data stored is an explicit listing of values.
Definition: BCP_enum.hpp:88
BCP_vec_change< double > _dual
The dual vector stored as a vector change.
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...
void fint fint fint real fint real real real real real real real real real * e
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
BCP_warmstart_dual()
The default constructor creates an empty WrtParent warmstart info (i.e., no change wrt the parent)...
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real * ws
virtual BCP_storage_t storage() const
Return how the warmstarting info is stored.
void update(const BCP_vec_change< T > &change)
Update the current vector with the argument vector.
Currently there isn&#39;t any error handling in BCP.
Definition: BCP_error.hpp:20
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116