BcpsModel.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Branch, Constrain and Price Software (BiCePS) *
3  * *
4  * BiCePS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Ted Ralphs, Lehigh University *
11  * *
12  * Conceptual Design: *
13  * *
14  * Yan Xu, Lehigh University *
15  * Ted Ralphs, Lehigh University *
16  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17  * Matthew Saltzman, Clemson University *
18  * *
19  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
20  * All Rights Reserved. *
21  *===========================================================================*/
22 
23 #ifndef BcpsModel_h_
24 #define BcpsModel_h_
25 
26 //#############################################################################
27 
28 #include <vector>
29 
30 #include "CoinMessageHandler.hpp"
31 
32 #include "AlpsModel.h"
33 #include "AlpsKnowledgeBroker.h"
34 
35 #include "BcpsMessage.h"
36 #include "BcpsObject.h"
37 
38 //#############################################################################
39 
40 class BcpsModel : public AlpsModel {
41 
42  protected:
43 
45  std::vector<BcpsConstraint *> constraints_;
46 
48  std::vector<BcpsVariable *> variables_;
49 
50 
55 
58 
61 
64 
65  public:
66 
68  :
71  {
75  }
76 
77  virtual ~BcpsModel() {
78  int i = 0;
79  int size = static_cast<int> (constraints_.size());
80  for (i = 0; i < size; ++i) {
81  delete constraints_[i];
82  }
83  size = static_cast<int> (variables_.size());
84  for (i = 0; i < size; ++i) {
85  delete variables_[i];
86  }
87  delete bcpsMessageHandler_;
88  }
89 
92  std::vector<BcpsConstraint *> & getConstraints() { return constraints_; }
93  std::vector<BcpsVariable *> & getVariables() { return variables_; }
94 
96  int getNumCoreVariables() const { return numCoreVariables_; }
101  void setConstraints(BcpsConstraint **con, int size) {
102  for (int j = 0; j < size; ++j) {
103  constraints_.push_back(con[j]);
104  }
105  }
107 
108  void setVariables(BcpsVariable **var, int size) {
109  for (int j = 0; j < size; ++j) {
110  variables_.push_back(var[j]);
111  }
112  }
113  void setNumCoreVariables(int num) { numCoreVariables_ = num; }
117  std::vector<BcpsVariable *> getVariables() const { return variables_; }
118 
120  std::vector<BcpsConstraint *> getConstrints() const { return constraints_; }
121 
124  { return bcpsMessageHandler_; }
125 
128 
129 
131  AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const;
132 
135 
136 };
137 
138 
139 #endif
std::vector< BcpsVariable * > variables_
Variables input by users (before preprocessing).
Definition: BcpsModel.h:48
std::vector< BcpsConstraint * > & getConstraints()
Get variables and constraints.
Definition: BcpsModel.h:92
virtual ~BcpsModel()
Definition: BcpsModel.h:77
Base class for message handling.
int numCoreVariables_
Number of core variables.
Definition: BcpsModel.h:57
void setNumCoreConstraints(int num)
Set variables and constraints.
Definition: BcpsModel.h:106
AlpsReturnStatus
Definition: Alps.h:118
std::vector< BcpsConstraint * > getConstrints() const
Return list of constraints.
Definition: BcpsModel.h:120
void setNumCoreVariables(int num)
Set variables and constraints.
Definition: BcpsModel.h:113
AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const
Pack Bcps portion of model into an encoded object.
std::vector< BcpsVariable * > getVariables() const
Return list of variables.
Definition: BcpsModel.h:117
CoinMessageHandler * bcpsMessageHandler_
Message handler.
Definition: BcpsModel.h:60
CoinMessageHandler * bcpsMessageHandler() const
Get the message handler.
Definition: BcpsModel.h:123
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
AlpsReturnStatus decodeBcps(AlpsEncoded &encoded)
Unpack Bcps portion of model from an encoded object.
std::vector< BcpsVariable * > & getVariables()
Get variables and constraints.
Definition: BcpsModel.h:93
int numCoreConstraints_
Number of core constraints.
Definition: BcpsModel.h:54
int getNumCoreConstraints() const
Get variables and constraints.
Definition: BcpsModel.h:95
void setConstraints(BcpsConstraint **con, int size)
Set variables and constraints.
Definition: BcpsModel.h:101
This is a first attempt at a message handler.
Class to hold and manipulate an array of massaged messages.
std::vector< BcpsConstraint * > constraints_
Constraints input by users (before preprocessing).
Definition: BcpsModel.h:45
int getNumCoreVariables() const
Get variables and constraints.
Definition: BcpsModel.h:96
void setLogLevel(int value)
Set current log (detail) level.
BcpsModel()
Definition: BcpsModel.h:67
CoinMessages bcpsMessages_
Bcps messages.
Definition: BcpsModel.h:63
void setVariables(BcpsVariable **var, int size)
Set variables and constraints.
Definition: BcpsModel.h:108
CoinMessages bcpsMessages()
Return messages.
Definition: BcpsModel.h:127