kiwi.js icon indicating copy to clipboard operation
kiwi.js copied to clipboard

Integer Variables

Open james-bryce opened this issue 5 years ago • 3 comments

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!

james-bryce avatar Aug 04 '19 14:08 james-bryce

Hi. No that's not possible. Why would you want this btw?

IjzerenHein avatar Aug 12 '19 11:08 IjzerenHein

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?

mreinstein avatar Oct 30 '19 15:10 mreinstein

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.

joshpoll avatar Oct 19 '20 16:10 joshpoll