Bcps 0.94.5
Loading...
Searching...
No Matches
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-2017, 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
31
32#include "AlpsModel.h"
33#include "AlpsKnowledgeBroker.h"
34
35#include "BcpsMessage.h"
36#include "BcpsObject.h"
37
38//#############################################################################
39
40class 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 }
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
132
135
136};
137
138
139#endif
AlpsReturnStatus
int getNumCoreConstraints() const
Definition BcpsModel.h:95
std::vector< BcpsVariable * > variables_
Variables input by users (before preprocessing).
Definition BcpsModel.h:48
CoinMessageHandler * bcpsMessageHandler_
Message handler.
Definition BcpsModel.h:60
void setNumCoreVariables(int num)
Definition BcpsModel.h:113
CoinMessageHandler * bcpsMessageHandler() const
Get the message handler.
Definition BcpsModel.h:123
int numCoreVariables_
Number of core variables.
Definition BcpsModel.h:57
std::vector< BcpsConstraint * > & getConstraints()
Get variables and constraints.
Definition BcpsModel.h:92
AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const
Pack Bcps portion of model into an encoded object.
int getNumCoreVariables() const
Definition BcpsModel.h:96
std::vector< BcpsConstraint * > getConstrints() const
Return list of constraints.
Definition BcpsModel.h:120
CoinMessages bcpsMessages()
Return messages.
Definition BcpsModel.h:127
AlpsReturnStatus decodeBcps(AlpsEncoded &encoded)
Unpack Bcps portion of model from an encoded object.
virtual ~BcpsModel()
Definition BcpsModel.h:77
void setConstraints(BcpsConstraint **con, int size)
Set variables and constraints.
Definition BcpsModel.h:101
CoinMessages bcpsMessages_
Bcps messages.
Definition BcpsModel.h:63
void setVariables(BcpsVariable **var, int size)
Definition BcpsModel.h:108
int numCoreConstraints_
Number of core constraints.
Definition BcpsModel.h:54
std::vector< BcpsConstraint * > constraints_
Constraints input by users (before preprocessing).
Definition BcpsModel.h:45
void setNumCoreConstraints(int num)
Definition BcpsModel.h:106
std::vector< BcpsVariable * > & getVariables()
Definition BcpsModel.h:93
std::vector< BcpsVariable * > getVariables() const
Return list of variables.
Definition BcpsModel.h:117
void setLogLevel(int value)