Last change
on this file since 202 was 201, checked in by Katsuhide Fujita, 6 years ago |
Add ANAC 2019 agents (2)
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | package agents.anac.y2019.authenticagent.acceptancestrategy;
|
---|
2 |
|
---|
3 | import authenticagent.dataclasses.LastReceivedOffer;
|
---|
4 | import authenticagent.serviceclasses.ReservedRankBidService;
|
---|
5 | import genius.core.AgentID;
|
---|
6 | import genius.core.actions.Accept;
|
---|
7 | import genius.core.actions.Action;
|
---|
8 | import genius.core.utility.UtilitySpace;
|
---|
9 |
|
---|
10 | public abstract class AbstractAcceptanceStrategy{
|
---|
11 | private UtilitySpace utilitySpace;
|
---|
12 |
|
---|
13 | AbstractAcceptanceStrategy(UtilitySpace us){
|
---|
14 | utilitySpace = us;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public Action acceptOrEnd(AgentID partyId){
|
---|
18 | if(LastReceivedOffer.bid == null)
|
---|
19 | return null;
|
---|
20 | double rank = utilitySpace.getUtility(LastReceivedOffer.bid);
|
---|
21 | if (rank >= utilitySpace.getReservationValue())
|
---|
22 | return new Accept(partyId, LastReceivedOffer.bid);
|
---|
23 | return null;
|
---|
24 | }
|
---|
25 |
|
---|
26 | protected boolean isAcceptable(double offeredUtility) {
|
---|
27 | return !isMoreThanOrEqualToReservationValue(offeredUtility);
|
---|
28 | }
|
---|
29 |
|
---|
30 | private boolean isMoreThanOrEqualToReservationValue(double offeredUtility){
|
---|
31 | return offeredUtility >= ReservedRankBidService.reservationValueFor(utilitySpace);
|
---|
32 | }
|
---|
33 |
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.