Last change
on this file since 100 was 100, checked in by ruud, 19 months ago |
python installs also wheel to avoid error messages
|
File size:
1.2 KB
|
Line | |
---|
1 | from abc import ABC
|
---|
2 | from decimal import Decimal
|
---|
3 | from typing import Optional
|
---|
4 |
|
---|
5 | from pyson.JsonSubTypes import JsonSubTypes
|
---|
6 | from pyson.JsonTypeInfo import JsonTypeInfo, Id, As
|
---|
7 |
|
---|
8 | from geniusweb.issuevalue.Value import Value
|
---|
9 | from 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"])
|
---|
15 | class 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.