Last change
on this file since 1 was 1, checked in by Wouter Pasman, 6 years ago |
Initial import : Genius 9.0.0
|
File size:
793 bytes
|
Line | |
---|
1 | package agents.anac.y2010.AgentFSEGA;
|
---|
2 |
|
---|
3 | import genius.core.Bid;
|
---|
4 | import genius.core.utility.AdditiveUtilitySpace;
|
---|
5 |
|
---|
6 | public class ReverseBidComparator implements java.util.Comparator<Bid>
|
---|
7 | {
|
---|
8 | private AdditiveUtilitySpace usp;
|
---|
9 | private final boolean TEST_EQUIVALENCE = false;
|
---|
10 |
|
---|
11 | public ReverseBidComparator(AdditiveUtilitySpace pUsp)
|
---|
12 | {
|
---|
13 | usp = pUsp;
|
---|
14 | }
|
---|
15 |
|
---|
16 | public int compare(Bid b1, Bid b2)
|
---|
17 | {
|
---|
18 | try
|
---|
19 | {
|
---|
20 | double u1 = usp.getUtility(b1);
|
---|
21 | double u2 = usp.getUtility(b2);
|
---|
22 | if (TEST_EQUIVALENCE) {
|
---|
23 | if (u1 == u2) {
|
---|
24 | return String.CASE_INSENSITIVE_ORDER.compare(b1.toString(), b2.toString());
|
---|
25 | }
|
---|
26 | }
|
---|
27 | if(u1 > u2)
|
---|
28 | return -1; // ! is reversed
|
---|
29 | else if(u1 < u2)
|
---|
30 | return 1;
|
---|
31 | else
|
---|
32 | return 0;
|
---|
33 | }
|
---|
34 | catch(Exception e)
|
---|
35 | { return -1; }
|
---|
36 | }
|
---|
37 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.