Changes between Version 139 and Version 140 of WikiStart
- Timestamp:
- 02/28/19 13:46:20 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiStart
v139 v140 198 198 }}} 199 199 |---------------------------- 200 === Value representation in Json 200 201 202 == Bids == 203 A Bid is a map with the issue names as keys (strings) and the values being an element from the valueset as in the domain description. 204 205 A bid typically looks like 206 {{{ 207 { "salary":"2000", "fte":"0.8", "work from home","0.6" ...} 208 }}} 209 210 This example also illustrates a problem with the json parser. In our jobs example domain, all issues have discrete values, so "2000" is just a string, not a number. 211 212 In this case, a specific problem occured that we had to figure a workaround for. Suppose we have a bid in the jobs domain: 213 214 201 215 202 216 Internally BigDecimal is used for computing and storing issue values, utilities etc. Doubles always give rounding problems and can not be assumed to sum properly to 1 and therefore can not be used. 217 218 In the special case of issue values, we can not determine a priori if the values are 203 219 204 220 Since JSON parses normal number directly into doubles, it is necessary to place numbers also inside string objects ("..."). That in turn forces us to put some hard marker in the string to see if "1" would be a discrete value or number value. To do this, any Value contained in a string that is of the form "=X.Y" where X is a positive or negative integer and Y a positive integer is a NumberValue. Anything else is interpreted as a DiscreteValue.