1 | package genius.core.uncertainty;
|
---|
2 |
|
---|
3 | import genius.core.boaframework.SortedOutcomeSpace;
|
---|
4 | import genius.core.utility.AbstractUtilitySpace;
|
---|
5 | import genius.core.utility.AdditiveUtilitySpaceWithPerturbation;
|
---|
6 | import genius.core.utility.UncertainAdditiveUtilitySpace;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | *
|
---|
10 | * Keeps track of both the real preferences of the user as well as the
|
---|
11 | * perception of the agent. The preference profile that is given to the agents
|
---|
12 | * can be a "distorted utility space" in the cases that uncertainty is included
|
---|
13 | * in the form of a perturbation to the real utilities (see
|
---|
14 | * {@link AdditiveUtilitySpaceWithPerturbation}}) or a flattened Utility Space
|
---|
15 | * (see {@link FlattenedUtilitySpace}), OR in the form of a Pairwise Comparison
|
---|
16 | * User Model (see {@link UserModel}). Used only in the core.
|
---|
17 | *
|
---|
18 | */
|
---|
19 |
|
---|
20 | public class UncertainPreferenceContainer {
|
---|
21 |
|
---|
22 | private UNCERTAINTYTYPE type;
|
---|
23 | private UncertainAdditiveUtilitySpace realUtilitySpace;
|
---|
24 | private UserModel pairwiseCompUserModel;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | *
|
---|
28 | * @param realUtilitySpace
|
---|
29 | * @param type
|
---|
30 | */
|
---|
31 |
|
---|
32 | public UncertainPreferenceContainer(UncertainAdditiveUtilitySpace utilspace,
|
---|
33 | UNCERTAINTYTYPE type) {
|
---|
34 | this.realUtilitySpace = utilspace;
|
---|
35 | this.type = type;
|
---|
36 |
|
---|
37 | createOutcomeComparisonUserModel(utilspace.getComparisons(),
|
---|
38 | utilspace.getErrors(), utilspace.getSeed(), utilspace.isExperimental());
|
---|
39 | }
|
---|
40 |
|
---|
41 | public UncertainPreferenceContainer(UncertainAdditiveUtilitySpace utilspace,
|
---|
42 | UNCERTAINTYTYPE type, int sizeOfBidRank) {
|
---|
43 | this.realUtilitySpace = utilspace;
|
---|
44 | this.type = type;
|
---|
45 | createOutcomeComparisonUserModel(sizeOfBidRank, utilspace.getErrors(), utilspace.getSeed(), utilspace.isExperimental());
|
---|
46 | }
|
---|
47 |
|
---|
48 | public UncertainPreferenceContainer(
|
---|
49 | UncertainPreferenceContainer container) {
|
---|
50 | this.realUtilitySpace = container.realUtilitySpace;
|
---|
51 | this.type = container.type;
|
---|
52 | this.pairwiseCompUserModel = container.pairwiseCompUserModel;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public UncertainPreferenceContainer(ExperimentalUserModel userModel) {
|
---|
56 | this.realUtilitySpace = userModel.getRealUtilitySpace();
|
---|
57 | this.type = UNCERTAINTYTYPE.PAIRWISECOMP;
|
---|
58 | this.pairwiseCompUserModel = userModel;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Generates comparisons between different outcomes. At the moment each
|
---|
63 | * outcome is part of only one comparison.
|
---|
64 | *
|
---|
65 | *
|
---|
66 | * @param amountOfBids,
|
---|
67 | * amount of bids to be compared
|
---|
68 | * @para error the number of errors. UNUSED
|
---|
69 | * @param seed
|
---|
70 | * if nonzero, this seed is used to pick the random bids
|
---|
71 | *
|
---|
72 | */
|
---|
73 | public void createOutcomeComparisonUserModel(int amountOfBids,
|
---|
74 | double error, long seed, boolean experimental) {
|
---|
75 | SortedOutcomeSpace outcomeSpace = (new SortedOutcomeSpace(this.getRealUtilitySpace()));
|
---|
76 | BidRanking ranking = (new ComparisonGenerator(outcomeSpace))
|
---|
77 | .generateRankingByAmount(amountOfBids, seed);
|
---|
78 | if (experimental)
|
---|
79 | this.pairwiseCompUserModel = new ExperimentalUserModel(ranking, realUtilitySpace);
|
---|
80 | else
|
---|
81 | this.pairwiseCompUserModel = new UserModel(ranking);
|
---|
82 | }
|
---|
83 |
|
---|
84 | public AbstractUtilitySpace getRealUtilitySpace() {
|
---|
85 | return realUtilitySpace;
|
---|
86 | }
|
---|
87 |
|
---|
88 | public UserModel getPairwiseCompUserModel() {
|
---|
89 | return pairwiseCompUserModel;
|
---|
90 | }
|
---|
91 |
|
---|
92 | public void setPairwiseCompUserModel(UserModel pairwiseCompUserModel) {
|
---|
93 | this.pairwiseCompUserModel = pairwiseCompUserModel;
|
---|
94 | }
|
---|
95 |
|
---|
96 | public UNCERTAINTYTYPE getType() {
|
---|
97 | return type;
|
---|
98 | }
|
---|
99 | }
|
---|