public void addEqualityConstraint(int[] arg0, double[] arg1, double arg2) { this.baseSolver.addEqualityConstraint(arg0, arg1, arg2); isSolved = false; }
public void addEqualityConstraint(int[] arg0, double[] arg1, double arg2) { this.baseSolver.addEqualityConstraint(arg0, arg1, arg2); isSolved = false; }
protected void addEqualityConstraint(ILPSolver xmp, int[] vars, double[] coefs, double rhs) { if (debug) { for (int i = 0; i < vars.length; i++) { System.out.print(coefs[i] + " x_" + vars[i] + " + "); } System.out.println(" = " + rhs); } xmp.addEqualityConstraint(vars, coefs, rhs); }
protected void addEqualityConstraint(ILPSolver xmp, int[] vars, double[] coefs, double rhs) { if (debug) { for (int i = 0; i < vars.length; i++) { System.out.print(coefs[i] + " x_" + vars[i] + " + "); } System.out.println(" = " + rhs); } xmp.addEqualityConstraint(vars, coefs, rhs); }
public void addEqualityConstraint(List<String> variables, double[] doubles, double rhs) { if (variables.size() != doubles.length) { throw new RuntimeException("variables.size() != doubles.length"); } int[] vars = variables.stream().mapToInt(this.variableNameToInteger::get).toArray(); this.solver.addEqualityConstraint(vars, doubles, rhs); }
public void addToILP(ILPSolver xmp) { if (this.sense == GRB.EQUAL) { xmp.addEqualityConstraint(vars, coeffs, rhs); } else if (this.sense == GRB.GREATER_EQUAL) { xmp.addGreaterThanConstraint(vars, coeffs, rhs); } else if (this.sense == GRB.LESS_EQUAL) { xmp.addLessThanConstraint(vars, coeffs, rhs); } else throw new RuntimeException("Invalid constraint of type: " + this.sense); }
public void addToILP(ILPSolver xmp) { if (this.sense == GRB.EQUAL) { xmp.addEqualityConstraint(vars, coeffs, rhs); } else if (this.sense == GRB.GREATER_EQUAL) { xmp.addGreaterThanConstraint(vars, coeffs, rhs); } else if (this.sense == GRB.LESS_EQUAL) { xmp.addLessThanConstraint(vars, coeffs, rhs); } else throw new RuntimeException("Invalid constraint of type: " + this.sense); }
private void addConstraint(ILPConstraint c) { if (c.sense == GRB.EQUAL) baseSolver.addEqualityConstraint(c.vars, c.coeffs, c.rhs); else if (c.sense == GRB.GREATER_EQUAL) baseSolver.addGreaterThanConstraint(c.vars, c.coeffs, c.rhs); else if (c.sense == GRB.LESS_EQUAL) baseSolver.addLessThanConstraint(c.vars, c.coeffs, c.rhs); else assert false : c.sense; }
private void addConstraint(ILPConstraint c) { if (c.sense == GRB.EQUAL) baseSolver.addEqualityConstraint(c.vars, c.coeffs, c.rhs); else if (c.sense == GRB.GREATER_EQUAL) baseSolver.addGreaterThanConstraint(c.vars, c.coeffs, c.rhs); else if (c.sense == GRB.LESS_EQUAL) baseSolver.addLessThanConstraint(c.vars, c.coeffs, c.rhs); else assert false : c.sense; }
/** * Derived classes override this method to do some type of processing on constraints of the * parameter's type. * * @param c The constraint to process. **/ public void visit(PropositionalDoubleImplication c) { assert topLevel : "ILP: PropositionalDoubleImplication encountered."; topLevel = false; int[] indexes = new int[2]; double[] coefficients = new double[2]; double bound = 0; c.left.runVisit(this); indexes[0] = returnIndex; if (returnNegation) { coefficients[0] = -1; --bound; } else coefficients[0] = 1; c.right.runVisit(this); indexes[1] = returnIndex; if (returnNegation) { coefficients[1] = 1; ++bound; } else coefficients[1] = -1; solver.addEqualityConstraint(indexes, coefficients, bound); topLevel = true; }
} else { System.err.println("ILP ERROR: Unsatisfiable constraints!"); solver.addEqualityConstraint(new int[] {0}, new double[] {1}, 2);
solver.addEqualityConstraint(indexes, coefficients, bound);