(* Here is a very simple Constraint Programming problem: Knowing that we see 56 legs and 20 heads, how many pheasants and rabbits are we looking at ?*)openGoogle.OrTools.ConstraintSolverletsolver=newSolver("pheasant")// Variablesletp=solver.MakeIntVar(0L,20L,"pheasant")letr=solver.MakeIntVar(0L,20L,"rabbit")// Constraintsletlegs=solver.MakeSum(solver.MakeProd(p,2L),solver.MakeProd(r,4L))letheads=solver.MakeSum(p,r)letconstraintLegs=solver.MakeEquality(legs,56)letconstraintHeads=solver.MakeEquality(heads,20)solver.Add(constraintLegs)solver.Add(constraintHeads)letvars=newIntVarVector([|p;r|])letdb=solver.MakePhase(vars,Solver.CHOOSE_FIRST_UNBOUND,Solver.ASSIGN_MIN_VALUE)// Solvesolver.NewSearch(db)while(solver.NextSolution())doprintfn"rabbits: %d, pheasants: %d"(r.Value())(p.Value())solver.EndSearch()