Blis 0.94
BlisPseudo.h
Go to the documentation of this file.
1/*===========================================================================*
2 * This file is part of the BiCePS Linear Integer Solver (BLIS). *
3 * *
4 * BLIS 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 * *
20 * Copyright (C) 2001-2019, Lehigh University, Yan Xu, and Ted Ralphs. *
21 * All Rights Reserved. *
22 *===========================================================================*/
23
24#ifndef BlisPseudo_h_
25#define BlisPseudo_h_
26
27#include "CoinError.hpp"
28#include "AlpsKnowledge.h"
29
30//#############################################################################
31
33{
34private:
36 double weight_;
37
39 double upCost_;
40
42 int upCount_;
43
45 double downCost_;
46
48 int downCount_;
49
54 double score_;
55
56public:
59 weight_(1.0),
60 upCost_(0.0),
61 upCount_(0),
62 downCost_(0.0),
63 downCount_(0),
64 score_(0.0)
65 {}
66
68 BlisPseudocost(double uc,
69 int un,
70 double dc,
71 int dn,
72 double s)
73 :
74 weight_(1.0),
75 upCost_(uc),
76 upCount_(un),
77 downCost_(dc),
78 downCount_(dn),
79 score_(s)
80 {}
81
84 weight_ = cost.weight_;
85 upCost_ = cost.upCost_;
86 upCount_ = cost.upCount_;
87 downCost_ = cost.downCost_;
88 downCount_ = cost.downCount_;
89 score_ = cost.score_;
90 }
91
94 weight_ = cost.weight_;
95 upCost_ = cost.upCost_;
96 upCount_ = cost.upCount_;
97 downCost_ = cost.downCost_;
98 downCount_ = cost.downCount_;
99 score_ = cost.score_;
100 return *this;
101 }
102
104 void setWeight(double w) {
105 if (w < 0.0 || w > 1.0) {
106 throw CoinError("weight is not in range [0,1]", "setWeight",
107 "BlisPseudo");
108 }
109 weight_= w;
110 }
111
113 void update(const int dir,
114 const double parentObjValue,
115 const double objValue,
116 const double solValue);
117
119 void update(const int dir,
120 const double objDiff,
121 const double solValue);
122
124 void update(double upCost,
125 int upCount,
126 double downCost,
127 int downCount);
128
130 int getUpCount() { return upCount_; }
131
133 double getUpCost() { return upCost_; }
134
136 int getDownCount() { return downCount_; }
137
139 double getDownCost() { return downCost_; }
140
142 double getScore() { return score_; }
143
145 void setScore(double s) { score_ = s; }
146
149
152
155 virtual AlpsEncoded* encode() const;
156
159};
160
161#endif
AlpsReturnStatus
virtual AlpsEncoded * encode() const
void setScore(double s)
Set importance.
Definition: BlisPseudo.h:145
void update(const int dir, const double parentObjValue, const double objValue, const double solValue)
Update pseudocost.
BlisPseudocost()
Default constructor.
Definition: BlisPseudo.h:58
double getDownCost()
Get down branching cost.
Definition: BlisPseudo.h:139
double getUpCost()
Get up branching cost.
Definition: BlisPseudo.h:133
BlisPseudocost(double uc, int un, double dc, int dn, double s)
Useful constructor.
Definition: BlisPseudo.h:68
int getUpCount()
Get up branching count.
Definition: BlisPseudo.h:130
void update(const int dir, const double objDiff, const double solValue)
Update pseudocost.
AlpsReturnStatus decodeFrom(AlpsEncoded &encoded)
Unpack pseudocost from the given encode object.
double getScore()
Get importance.
Definition: BlisPseudo.h:142
int getDownCount()
Get down branching count.
Definition: BlisPseudo.h:136
BlisPseudocost(const BlisPseudocost &cost)
Copy constructor.
Definition: BlisPseudo.h:83
BlisPseudocost & operator=(const BlisPseudocost &cost)
Overload operator =.
Definition: BlisPseudo.h:93
AlpsReturnStatus encodeTo(AlpsEncoded *encoded) const
Pack pseudocost to the given object.
void update(double upCost, int upCount, double downCost, int downCount)
Update pseudocost.
virtual AlpsKnowledge * decode(AlpsEncoded &) const
Decode a node from an encoded object.
virtual AlpsEncoded * encode() const
Encode this node for message passing.
void setWeight(double w)
Set weigth.
Definition: BlisPseudo.h:104