Last change
on this file was 202, checked in by Katsuhide Fujita, 5 years ago |
Add ANAC 2019 agents (3)
|
-
Property svn:executable
set to
*
|
File size:
589 bytes
|
Line | |
---|
1 | package agents.anac.y2019.fsega2019.fsegaoppmodel;
|
---|
2 |
|
---|
3 | import genius.core.Bid;
|
---|
4 | import genius.core.utility.UtilitySpace;
|
---|
5 |
|
---|
6 | public class ReverseBidComparator implements java.util.Comparator<Bid>
|
---|
7 | {
|
---|
8 | private UtilitySpace usp;
|
---|
9 |
|
---|
10 | public ReverseBidComparator(UtilitySpace pUsp)
|
---|
11 | {
|
---|
12 | usp = pUsp;
|
---|
13 | }
|
---|
14 |
|
---|
15 | public int compare(Bid b1, Bid b2)
|
---|
16 | {
|
---|
17 | try
|
---|
18 | {
|
---|
19 | double u1 = usp.getUtility(b1);
|
---|
20 | double u2 = usp.getUtility(b2);
|
---|
21 | if(u1 > u2)
|
---|
22 | return -1; // ! is reversed
|
---|
23 | else if(u1 < u2)
|
---|
24 | return 1;
|
---|
25 | else
|
---|
26 | return 0;
|
---|
27 | }
|
---|
28 | catch(Exception e)
|
---|
29 | { return -1; }
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.