[74] | 1 | from abc import ABC, abstractmethod
|
---|
| 2 | from geniusweb.issuevalue.Domain import Domain
|
---|
| 3 | from geniusweb.issuevalue.Bid import Bid
|
---|
| 4 | from geniusweb.references.Parameters import Parameters
|
---|
| 5 | from geniusweb.actions.Action import Action
|
---|
| 6 | from geniusweb.progress.Progress import Progress
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | class OpponentModel(ABC):
|
---|
| 10 | '''
|
---|
| 11 | An opponentmodel estimates a {@link UtilitySpace} from received opponent
|
---|
| 12 | actions.
|
---|
| 13 | <h2>Requirement</h2> A OpponentModel must have a constructor that takes the
|
---|
| 14 | Domain as argument. unfortunately this can not be enforced in a java
|
---|
| 15 | interface
|
---|
| 16 |
|
---|
| 17 | <p>
|
---|
| 18 | <em>MUST</em> have an empty constructor as these are also used as part of the
|
---|
| 19 | BOA framework.
|
---|
| 20 | '''
|
---|
| 21 |
|
---|
| 22 | @abstractmethod
|
---|
| 23 | def With(self, domain: Domain, resBid: Bid) -> "OpponentModel":
|
---|
| 24 | '''
|
---|
| 25 | Initializes the model. This function must be called first after
|
---|
| 26 | constructing an instance. It can also be called again later, if there is
|
---|
| 27 | a change in the domain or resBid.
|
---|
| 28 | <p>
|
---|
| 29 | This late-initialization is to support boa models that have late
|
---|
| 30 | initialization.
|
---|
| 31 |
|
---|
| 32 | @param domain the domain to work with. Must be not null.
|
---|
| 33 | @param resBid the reservation bid, or null if no reservationbid is
|
---|
| 34 | available.
|
---|
| 35 | @return OpponentModel that uses given domain and reservationbid.
|
---|
| 36 | '''
|
---|
| 37 |
|
---|
| 38 | @abstractmethod
|
---|
| 39 | def WithParameters(self, parameters: Parameters) -> "OpponentModel":
|
---|
| 40 | '''
|
---|
| 41 | @param parameters Opponent-model specific {@link Parameters}
|
---|
| 42 | @return an updated OpponentMode, with parameters used. Each
|
---|
| 43 | implementation of OpponentModel is free to use parameters as it
|
---|
| 44 | likes. For instance to set learning speed.
|
---|
| 45 | '''
|
---|
| 46 |
|
---|
| 47 | @abstractmethod
|
---|
| 48 | def WithAction(self, action: Action, progress: Progress) -> "OpponentModel":
|
---|
| 49 | '''
|
---|
| 50 | Update this with a new action that was done by the opponent that this
|
---|
| 51 | model is modeling. {@link #with(Domain, Bid)} must be called before
|
---|
| 52 | calling this.
|
---|
| 53 |
|
---|
| 54 | @param action the new incoming action.
|
---|
| 55 | @param progress the current progress of the negotiation. Calls to this
|
---|
| 56 | must be done with increasing progress.
|
---|
| 57 | @return the updated {@link OpponentModel}
|
---|
| 58 | '''
|
---|