-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathState.cpp
48 lines (32 loc) · 889 Bytes
/
State.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "State.h"
// TODO: Suitably choose W
double W = 1000000;
State::State(std::vector<int> bidNumbers, double cost, int numConflicts) {
this->bidNumbers = bidNumbers;
this->cost = cost;
this->numConflicts = numConflicts;
}
std::vector<int> State::getBidNumbers() {
return this->bidNumbers;
}
void State::setBidNumbers(std::vector<int> bidNumbers) {
this->bidNumbers = bidNumbers;
}
int State::getConflicts() const {
return this->numConflicts;
}
void State::setConflicts(int numConflicts) {
this->numConflicts = numConflicts;
}
double State::getCost() const {
return this->cost;
}
double State::getFitness() const {
return (getCost() - W * getConflicts());
}
bool State::isValid() {
return (this->getConflicts() == 0);
}
bool State::operator==(const State &state) const {
return (this->getFitness() == state.getFitness());
}