kiwi.js
kiwi.js copied to clipboard
Integer Variables
Hello,
Is it possible to force variable values to be integers?
For example, I want the value to be either 0 or 1 (nothing in between).
Thanks!
Hi. No that's not possible. Why would you want this btw?
There are lotos of cases where this could be potentially useful. You're computing layout and want whole integer values for pixel coordinates, etc. Why is it impossible?
Linear programming with integer constraints is known as (mixed) integer linear programming (MILP or ILP). While linear programming problems can be solved in polynomial time, ILP is NP-complete. ILP solvers are based on linear programming solvers, but with significant added complexity. I think it's out of the scope of Kiwi (and other Cassowary solvers) to handle ILP.