Last change
on this file since 345 was 1, checked in by Wouter Pasman, 6 years ago |
Initial import : Genius 9.0.0
|
File size:
438 bytes
|
Line | |
---|
1 | package agents.anac.y2014.Gangster;
|
---|
2 |
|
---|
3 |
|
---|
4 | import genius.core.Bid;
|
---|
5 | import genius.core.issue.ValueInteger;
|
---|
6 |
|
---|
7 | class Utils {
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 | public static int calculateManhattanDistance(Bid bid1, Bid bid2) throws Exception{
|
---|
12 |
|
---|
13 | int numIssues = bid1.getValues().size();
|
---|
14 |
|
---|
15 | int x = 0;
|
---|
16 | for(int i=1; i<=numIssues; i++){
|
---|
17 | x += Math.abs(((ValueInteger)bid1.getValue(i)).getValue() - ((ValueInteger)bid2.getValue(i)).getValue());
|
---|
18 | }
|
---|
19 |
|
---|
20 | return x;
|
---|
21 |
|
---|
22 | }
|
---|
23 |
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.