Rev | Line | |
---|
[74] | 1 | class AcceptanceStrategy:
|
---|
| 2 | def __init__(self, profile, floor, domain):
|
---|
| 3 | self._profile = profile
|
---|
| 4 | self._floor = floor
|
---|
| 5 | self._issues = domain.getIssues()
|
---|
| 6 |
|
---|
| 7 | # method that checks if we would agree with an offer
|
---|
| 8 | def is_good(self, opponent_bid, my_bid, progress):
|
---|
| 9 | # very basic approach that accepts if the offer is valued above [floor] and
|
---|
| 10 | # 80% of the rounds towards the deadline have passed
|
---|
| 11 | a_const = False
|
---|
| 12 | if opponent_bid is not None:
|
---|
| 13 | a_const = self._profile.getUtility(opponent_bid) > self._floor
|
---|
| 14 |
|
---|
| 15 | return (
|
---|
| 16 | self._accept_next(opponent_bid, my_bid)
|
---|
| 17 | or a_const
|
---|
| 18 | and progress > 0.8
|
---|
| 19 | )
|
---|
| 20 |
|
---|
| 21 | def _accept_next(self, opponent_bid, my_bid):
|
---|
| 22 | return opponent_bid is not None and self._profile.getUtility(opponent_bid) > self._profile.getUtility(my_bid)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.