import org.chocosolver.solver.Model; import org.chocosolver.solver.Solution; import org.chocosolver.solver.Solver; import org.chocosolver.solver.constraints.Constraint; import org.chocosolver.solver.objective.ParetoOptimizer; import org.chocosolver.solver.variables.IntVar; import java.io.FileWriter; public class teste { public static void main(String[] args) { Model m = new Model("test"); IntVar soilSum = m.intVar(30, 200); IntVar one = m.intVar(1); IntVar soilToMaximize = m.intVar(-9999999,999999); m.arithm(soilToMaximize, "=", one, "-", soilSum).post(); m.setObjective(Model.MAXIMIZE, soilToMaximize); Solver s = m.getSolver(); if (s.solve()) { System.out.println(soilToMaximize); System.out.println(soilSum); } } }