source: geniuswebcore/geniusweb/profile/utilityspace/UtilitySpace.py@ 74

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

Fix for IssueValue hashcode.

File size: 686 bytes
Line 
1from decimal import Decimal
2
3from geniusweb.issuevalue.Bid import Bid
4from geniusweb.profile.FullOrdering import FullOrdering
5
6
7class UtilitySpace (FullOrdering ):
8 '''
9 A utilityspace defines a profile in terms of a utility of a bid. Bids with
10 higher utility are preferred over bids with less utility.
11 '''
12
13 def getUtility(self, bid:Bid ) -> Decimal:
14 '''
15 @param bid the {@link Bid} to be evaluated
16 @return the utility value of this bid. This MUST return a number in the range
17 [0,1]. 0 means preferred the least and 1 means preferred the most.
18 '''
19
20 def isPreferredOrEqual(self, bid1:Bid, bid2:Bid ) -> bool:
21 return self.getUtility(bid1) >= self.getUtility(bid2)
22
Note: See TracBrowser for help on using the repository browser.