-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsumer.h
54 lines (45 loc) · 1.36 KB
/
Consumer.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CONSUMER_H_
#define CONSUMER_H_
#include <map>
#include <vector>
#include <iostream>
#include <boost/math/distributions.hpp>
#include "Principal.h"
class Simulator;
class Authority;
class Producer;
class Profile;
class Consumer : public Principal {
public:
Consumer(Simulator *sim, int id, double claim_prob = 1.0);
void deleteValues();
int getID();
void setStep(int step);
int getStep();
void resetCountClaim();
void incrementCountClaim();
int getCountClaim();
void setClaimProbability(double claim_prob);
double getClaimProbability();
void setPolicy(Producer *producer);
bool havePolicy(Producer *producer);
void setValue(Producer *producer, Profile *value);
Profile* getValue(Producer *producer);
bool addCandidate(Producer *producer);
std::vector<Producer *> getCandidates();
double getMaximumPremium(Producer *producer);
bool obtainInformation(Authority *authority, Producer *producer);
void fixValue(Producer *producer);
int getNumberOfNotConsumedProducers();
int getIndexOfNotConsumedProducer(int idx);
void consumed(int i);
private:
int id, step, count_claim;
double claim_prob;
std::map<Producer *, Profile *> values;
std::vector<Producer *> candidates;
std::map<Producer *, bool> policies;
std::vector<int> not_consumed_indices;
double calculateMaximumPremiumExponential(Producer *producer);
};
#endif