Blis 0.95.0
Loading...
Searching...
No Matches
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-2023, 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#include "BlisConfig.h"
30
31//#############################################################################
32
33class BLISLIB_EXPORT BlisPseudocost : public AlpsKnowledge
34{
35private:
37 double weight_;
38
40 double upCost_;
41
43 int upCount_;
44
46 double downCost_;
47
49 int downCount_;
50
55 double score_;
56
57public:
60 weight_(1.0),
61 upCost_(0.0),
62 upCount_(0),
63 downCost_(0.0),
64 downCount_(0),
65 score_(0.0)
66 {}
67
69 BlisPseudocost(double uc,
70 int un,
71 double dc,
72 int dn,
73 double s)
74 :
75 weight_(1.0),
76 upCost_(uc),
77 upCount_(un),
78 downCost_(dc),
79 downCount_(dn),
80 score_(s)
81 {}
82
85 weight_ = cost.weight_;
86 upCost_ = cost.upCost_;
87 upCount_ = cost.upCount_;
88 downCost_ = cost.downCost_;
89 downCount_ = cost.downCount_;
90 score_ = cost.score_;
91 }
92
95 weight_ = cost.weight_;
96 upCost_ = cost.upCost_;
97 upCount_ = cost.upCount_;
98 downCost_ = cost.downCost_;
99 downCount_ = cost.downCount_;
100 score_ = cost.score_;
101 return *this;
102 }
103
105 void setWeight(double w) {
106 if (w < 0.0 || w > 1.0) {
107 throw CoinError("weight is not in range [0,1]", "setWeight",
108 "BlisPseudo");
109 }
110 weight_= w;
111 }
112
114 void update(const int dir,
115 const double parentObjValue,
116 const double objValue,
117 const double solValue);
118
120 void update(const int dir,
121 const double objDiff,
122 const double solValue);
123
125 void update(double upCost,
126 int upCount,
127 double downCost,
128 int downCount);
129
131 int getUpCount() { return upCount_; }
132
134 double getUpCost() { return upCost_; }
135
137 int getDownCount() { return downCount_; }
138
140 double getDownCost() { return downCost_; }
141
143 double getScore() { return score_; }
144
146 void setScore(double s) { score_ = s; }
147
149 AlpsReturnStatus encodeTo(AlpsEncoded *encoded) const;
150
152 AlpsReturnStatus decodeFrom(AlpsEncoded &encoded);
153
154 using AlpsKnowledge::encode ;
156 virtual AlpsEncoded* encode() const;
157
159 virtual AlpsKnowledge* decode(AlpsEncoded&) const;
160};
161
162#endif
void setScore(double s)
Set importance.
Definition BlisPseudo.h:146
void update(const int dir, const double parentObjValue, const double objValue, const double solValue)
Update pseudocost.
BlisPseudocost()
Default constructor.
Definition BlisPseudo.h:59
double getDownCost()
Get down branching cost.
Definition BlisPseudo.h:140
double getUpCost()
Get up branching cost.
Definition BlisPseudo.h:134
BlisPseudocost(double uc, int un, double dc, int dn, double s)
Useful constructor.
Definition BlisPseudo.h:69
int getUpCount()
Get up branching count.
Definition BlisPseudo.h:131
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:143
int getDownCount()
Get down branching count.
Definition BlisPseudo.h:137
BlisPseudocost(const BlisPseudocost &cost)
Copy constructor.
Definition BlisPseudo.h:84
BlisPseudocost & operator=(const BlisPseudocost &cost)
Overload operator =.
Definition BlisPseudo.h:94
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:105
#define BLISLIB_EXPORT
Definition config.h:5