Last change
on this file since 253 was 253, checked in by Faria Nassiri Mofakham, 5 years ago |
Commit #1 of:
+ negotiator.onetomany package refactored into onetomany package.
+ info created for all contained the packages.
+ current work defined under onetomany.bargainingchipsgame.
+ in this package, onetomany.bargainingchipsgame.players package includes packages for utility function, coordinator, negotiatior, and buyer and seller.
+ negotiator.onetomany package now contains nothing, can be deleted.
+ Interaction thread
|
File size:
919 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 UtilityFunction
|
---|
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 | @Override
|
---|
27 | public Double getUtility(Bundle b)
|
---|
28 | {
|
---|
29 | // TODO Auto-generated method stub
|
---|
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()==t.getChip().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.