BCP_warmstart_basis.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #include "CoinWarmStartBasis.hpp"
5 
6 //#############################################################################
7 
8 CoinWarmStart*
10 {
12  return NULL;
13 
16  return
17  new CoinWarmStartBasis(vst.size(), cst.size(), vst.begin(), cst.begin());
18 }
19 
20 //#############################################################################
21 
24  // The storage is WrtParent if at least one status set is WrtParent
25  const BCP_storage_t vst = _var_stat.storage();
26  const BCP_storage_t cst = _cut_stat.storage();
27  if (vst == BCP_Storage_WrtParent || cst == BCP_Storage_WrtParent)
28  return BCP_Storage_WrtParent;
29  // Otherwise Explicit if at least one status set is Explicit
30  if (vst == BCP_Storage_Explicit || cst == BCP_Storage_Explicit)
31  return BCP_Storage_Explicit;
32  // Otherwise it must be NoData
33  return BCP_Storage_NoData;
34 }
35 
36 //#############################################################################
37 
38 void
40 {
41  const BCP_warmstart_basis* ch =
42  dynamic_cast<const BCP_warmstart_basis*>(change);
43  if (! ch)
44  throw BCP_fatal_error("BCP_warmstart_basis::update\n \
45 Can't update a BCP_warmstart_basis with a different warmstart.\n");
46 
49 }
50 
51 
52 //#############################################################################
53 
56  const BCP_vec<int>& del_vars,
57  const BCP_vec<int>& del_cuts,
58  const double petol,
59  const double detol) const
60 {
61  const BCP_warmstart_basis* const ows =
62  dynamic_cast<const BCP_warmstart_basis* const>(old_ws);
63  if (!ows)
64  throw BCP_fatal_error("BCP_warmstart_basis::as_change\n \
65 trying to describe a BCP_warmstart_basis as a change to a different ws!\n");
66 
68  throw BCP_fatal_error("BCP_warmstart_basis::as_change\n \
69 current data is not explicit!\n");
70 
71  if (ows->storage() == BCP_Storage_WrtParent)
72  throw BCP_fatal_error("\
73 BCP_warmstart_dual::as_change : old_ws is WrtParent!\n");
74 
75  if (ows->storage() == BCP_Storage_NoData)
76  return new BCP_warmstart_basis(*this);
77 
78  // Both are explicit
80 
82  del_vars);
83  if (ws->_var_stat.storage_size() > ows->_var_stat.storage_size())
84  ws->_var_stat = ows->_var_stat;
85 
87  del_cuts);
88  if (ws->_cut_stat.storage_size() > ows->_cut_stat.storage_size())
89  ws->_cut_stat = ows->_cut_stat;
90 
91  return ws;
92 }
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...
BCP_vec_change< char > _var_stat
The stati of the variables stored as a vector change.
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.
virtual CoinWarmStart * convert_to_CoinWarmStart() const
Return an CoinwarmStart object that can be fed to the LP engine.
The data stored is an explicit listing of values.
Definition: BCP_enum.hpp:88
BCP_warmstart_basis()
The default constructor creates an empty WrtParent warmstart info (i.e., no change wrt the parent)...
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_storage_t storage() const
Return the storage type of the vector.
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real * ws
void update(const BCP_vec_change< T > &change)
Update the current vector with the argument vector.
virtual void update(const BCP_warmstart *const change)
Update the current data with the one in the argument.
Currently there isn&#39;t any error handling in BCP.
Definition: BCP_error.hpp:20
BCP_vec_change< char > _cut_stat
The stati of the cuts stored as a vector change.
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116
This class describes a warmstart information that consists of basis information for structural and ar...
BCP_storage_t
This enumerative constant describes how to store certain data for a search tree node.
Definition: BCP_enum.hpp:84
virtual BCP_storage_t storage() const
Return how the warmstarting info is stored.