Rabbits and Pheasants
Setup
Mix.install([
{:exhort, git: "https://github.com/elixir-or-tools/exhort"}
])
use Exhort.SAT.Builder
Model
response =
Builder.new()
|> Builder.def_int_var("r", {0, 100})
|> Builder.def_int_var("p", {0, 100})
|> Builder.constrain("r" + "p" == 20)
|> Builder.constrain(4 * "r" + 2 * "p" == 56)
|> Builder.build()
|> Model.solve()