Last change
on this file was 1, checked in by Wouter Pasman, 7 years ago |
Initial import : Genius 9.0.0
|
File size:
1.1 KB
|
Line | |
---|
1 | package genius.core.analysis.pareto;
|
---|
2 |
|
---|
3 | import java.util.Collections;
|
---|
4 | import java.util.Set;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Similar to BidPoint but can hold partial bids. Generic as it uses IssueValue
|
---|
8 | *
|
---|
9 | */
|
---|
10 | public class PartialBidPoint {
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * This needs to be slightly negative, so that isDominatedBy also says yes
|
---|
14 | * if the other point is slightly negative of our point.
|
---|
15 | */
|
---|
16 | private final static double MIN_DELTA = -0.0000000000001;
|
---|
17 | private final Set<IssueValue> values;
|
---|
18 | /**
|
---|
19 | * Caches the actual sum of the value utilities.
|
---|
20 | */
|
---|
21 | private final Double utilA, utilB;
|
---|
22 |
|
---|
23 | public PartialBidPoint(Set<IssueValue> values, Double utilA, Double utilB) {
|
---|
24 | this.values = values;
|
---|
25 | this.utilA = utilA;
|
---|
26 | this.utilB = utilB;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public Double utilA() {
|
---|
30 | return utilA;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public Double utilB() {
|
---|
34 | return utilB;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public Set<IssueValue> getValues() {
|
---|
38 | return Collections.unmodifiableSet(values);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public boolean isDominatedBy(PartialBidPoint p) {
|
---|
42 | return (p.utilA - utilA > MIN_DELTA) && (p.utilB - utilB > MIN_DELTA);
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public String toString() {
|
---|
47 | return "point(" + utilA + "," + utilB + ")";
|
---|
48 | }
|
---|
49 |
|
---|
50 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.