source: geniuswebcore/geniusweb/profile/utilityspace/ValueSetUtilities.py@ 81

Last change on this file since 81 was 81, checked in by Bart Vastenhouw, 2 years ago

Added python timedependent parties (conceder, hardliner, etc)

File size: 1.2 KB
Line 
1from abc import ABC
2from decimal import Decimal
3from typing import Optional
4
5from pyson.JsonSubTypes import JsonSubTypes
6from pyson.JsonTypeInfo import JsonTypeInfo, Id, As
7
8from geniusweb.issuevalue.Value import Value
9from geniusweb.issuevalue.ValueSet import ValueSet
10
11
12@JsonTypeInfo(use = Id.NAME, include = As.WRAPPER_OBJECT)
13@JsonSubTypes(["geniusweb.profile.utilityspace.DiscreteValueSetUtilities.DiscreteValueSetUtilities",
14 "geniusweb.profile.utilityspace.NumberValueSetUtilities.NumberValueSetUtilities"])
15class ValueSetUtilities(ABC) :
16 '''
17 Provides a mechanism to map {@link Value}s into a utility (value in range
18 [0,1]).
19 '''
20
21 def getUtility(self, value:Optional[Value] )->Decimal:
22 '''
23 @param value the {@link Value} to get the utility for
24 @return the utility of the given value. MUST be in [0,1]. Should return 0
25 if the value is unknown.
26 '''
27
28 def isFitting(self, valueset: ValueSet) -> Optional[str]:
29 '''
30 @param valueset the valueset that is supposed match with this
31 @return null if the ValueSetUtilities fits the given set of values , that
32 means it can give utilities for all possible values in valueset.
33 Or a string containing an explanation why not.
34 '''
35
Note: See TracBrowser for help on using the repository browser.