LinearProgram lp =
new LinearProgram(
new double[]{5.0,10.0});
lp.addConstraint(
new LinearBiggerThanEqualsConstraint(
new double[]{3.0,1.0}, 8.0,
"c1"));
lp.addConstraint(
new LinearBiggerThanEqualsConstraint(
new double[]{0.0,4.0}, 4.0,
"c2"));
lp.addConstraint(
new LinearSmallerThanEqualsConstraint(
new double[]{2.0,0.0}, 2.0,
"c3"));
lp.setMinProblem(
true);
LinearProgramSolver solver = SolverFactory.newDefault();
double[] sol = solver.solve(lp);
lpw.addConstraint(
"c2",4,
"<=").plus(
"x2",4.0).setAllVariablesInteger();
lpw.addConstraint(
"c3", 2,
">=").plus(
"x1",2.0).setAllVariablesBoolean();
.