Last change
on this file since 257 was 254, checked in by Faria Nassiri Mofakham, 5 years ago |
Commit #2:
Fixed errors
|
File size:
910 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * UtilityFunctionSimpleAdditive class
|
---|
3 | */
|
---|
4 | package onetomany.bargainingchipsgame.players.utilityfunction;
|
---|
5 |
|
---|
6 | import onetomany.bargainingchipsgame.Bundle;
|
---|
7 | import onetomany.bargainingchipsgame.Stack;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * @author Faria Nassiri-Mofakham
|
---|
11 | *
|
---|
12 | */
|
---|
13 | public class UF_SimpleAdditive implements Utility_Function
|
---|
14 | {
|
---|
15 |
|
---|
16 | double lambda1, lambda2;
|
---|
17 | // Bundle wishlist;
|
---|
18 |
|
---|
19 | public UF_SimpleAdditive(double l1, double l2)//, Bundle w)
|
---|
20 | {
|
---|
21 | this.lambda1=l1;
|
---|
22 | this.lambda2=l2;
|
---|
23 | // this.wishlist=w;
|
---|
24 | }
|
---|
25 |
|
---|
26 | // TODO Auto-generated method stub
|
---|
27 | @Override
|
---|
28 | public Double getUtility(Bundle b)
|
---|
29 | {
|
---|
30 | double sum=0.0;
|
---|
31 | if (b!=null)
|
---|
32 | {
|
---|
33 | for (Stack s : b)
|
---|
34 | // for (Stack t: wishlist)
|
---|
35 | // if (s.getChip().getColor()==b.getColor())
|
---|
36 | {
|
---|
37 | sum+=lambda1*s.getQuantity();
|
---|
38 | }
|
---|
39 | }
|
---|
40 | return null;
|
---|
41 | }
|
---|
42 | @Override
|
---|
43 | public String toString()
|
---|
44 | {
|
---|
45 | return this.getClass().getSimpleName();
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.