PCG
PCG copied to clipboard
Add a Cost type
Currently, our "cost" type is a Double
or a new-typed Double
labeled ExtendedReal
.
Our use-case for Cost
does not overlap well with the Num
and related "numeric" type-class instances.
Our Cost
should have the following invariants:
- Non-negative
- Monotonically non-decreasing "addition"
- Equatable
- Total ordering
- An "infinite value" representation
- Perfect precision for rational numbers
- Reasonable efficiency
We could represent Cost
as a non-negative rational number and a Monoid
under addition.