-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.h
39 lines (35 loc) · 943 Bytes
/
solution.h
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
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <random>
using namespace std;
typedef enum
{
SINGLE,
ONEBYONE,
MEAN
} crossover_type;
class Solution
{
vector<double> accountPrices;
vector<double> stats;
vector<int> assignments;
int numAccounts, numBrokers;
double cost;
bool isValid;
void calculateAccountPrices(const vector<double> &brokerPrices);
void calculateStats();
public:
Solution(const vector<int> &sol, int _nAccounts, int _nBrokers /*, const vector<double> &brokerPrice*/);
Solution(const Solution *parent1, const Solution *parent2, crossover_type cType);
bool getIsValid();
void setIsValid(bool valid);
double getCost();
void setCost(double score);
bool operator<(const Solution &s2) const;
int applyMutation(int val);
vector<int> &getAssignments();
//price mean and MSE
vector<double> getStats();
};