-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpareto_front.h
More file actions
64 lines (40 loc) · 1.88 KB
/
Copy pathpareto_front.h
File metadata and controls
64 lines (40 loc) · 1.88 KB
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
55
56
57
58
59
60
61
62
63
64
//
// Created by qzz on 2023/11/5.
//
#ifndef BRIDGE_LEARNING_PLAYCC_PARETO_FRONT_H_
#define BRIDGE_LEARNING_PLAYCC_PARETO_FRONT_H_
#include <ostream>
#include "outcome_vector.h"
class ParetoFront {
public:
ParetoFront() = default;
explicit ParetoFront(const std::vector<OutcomeVector> &outcome_vectors);
ParetoFront(const ParetoFront &) = default;
[[nodiscard]] int Size() const { return static_cast<int>(outcome_vectors_.size()); }
bool Insert(const OutcomeVector &outcome_vector);
[[nodiscard]] std::string ToString() const;
[[nodiscard]] std::vector<OutcomeVector> OutcomeVectors() const { return outcome_vectors_; }
[[nodiscard]] bool Empty() const { return outcome_vectors_.empty(); }
[[nodiscard]] double Score() const;
[[nodiscard]] OutcomeVector BestOutcome() const;
void SetMove(const ble::BridgeMove &move);
static ParetoFront ParetoFrontWithOneOutcomeVector(const std::vector<int> &possible_worlds, int fill_value);
[[nodiscard]] std::string Serialize() const;
static ParetoFront Deserialize(const std::string &str);
void RemoveVectorsDominatedBy(const OutcomeVector& r);
private:
std::vector<OutcomeVector> outcome_vectors_;
[[nodiscard]] bool HasSameVector(const OutcomeVector &outcome_vector) const;
};
ParetoFront operator*(const ParetoFront &lhs, const ParetoFront &rhs);
bool operator==(const ParetoFront &lhs, const ParetoFront &rhs);
bool operator<=(const ParetoFront &lhs, const ParetoFront &rhs);
ParetoFront ParetoFrontMin(const ParetoFront &lhs, const ParetoFront &rhs);
ParetoFront ParetoFrontMax(const ParetoFront &lhs, const ParetoFront &rhs);
bool ParetoFrontDominate(const ParetoFront &lhs, const ParetoFront &rhs);
std::ostream &operator<<(std::ostream &stream, const ParetoFront &front);
//struct BridgeMoveOutcomeVector{
// ble::BridgeMove move;
// OutcomeVector outcome_vector;
//};
#endif // BRIDGE_LEARNING_PLAYCC_PARETO_FRONT_H_