Non-integer capacity values?

I found that Capacity in jsprit only supports integer values. Is there any reason not support float/double values? In real world problems, our data such as weight and volume is usually float numbers. How could I handle those capacity restrictions with jsprit?


I agree with your statement that size dimensions could be fractuals, therefore floating point values is appearing at the first glance. However, it would cause other problems to handle: the rounding errors, which, without proper handling, would cause over- or underloaded vehicles. Proper handling would require calculating with more significant digits and rounding. It is an expensive operation and the algorithm would have to do it a lot of times.

One workaround for the problem: determine the significant digits you need to handle, call it n. (Let’s say, 3 to handle kg, instead of ton) Multiply your capacity values with 10^n. Now all your capacities could be defined as integers.

(Sidenote: This solution works with other multiplicators than 10^n, as well. Take the least common multiple of all the values and it would give you the factor. It leads to a harder to read capacity values, but would behave better with values not easily defines in 10-based or binary radixes. (Such as 1/3.)


Thank you @Balage1551. I’ll add significant digits in my problem definition.