source: geniuswebcore/geniusweb/opponentmodel/OpponentModel.py@ 92

Last change on this file since 92 was 90, checked in by Bart Vastenhouw, 3 years ago

Refactor to help reusing partiesserver.

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