private void addConstraint(int[] ids, double[] coefs, double rhs, char type) { constraints.add(new ILPConstraint(ids, coefs, rhs, type)); isSolved = false; }
private void addConstraint(int[] ids, double[] coefs, double rhs, char type) { constraints.add(new ILPConstraint(ids, coefs, rhs, type)); isSolved = false; }
list.add(new ILPConstraint(vars, coefs, vars.length - 1, ILPConstraint.GREATER_THAN));
list.add(new ILPConstraint(vars, coefs, 1.0, ILPConstraint.GREATER_THAN));
constraints.add(new ILPConstraint(new int[] { nullVar, otherNullVar }, new double[] { 1, 1 }, 1, ILPConstraint.GREATER_THAN));
list.add(new ILPConstraint(vars, coefs, 0, ILPConstraint.GREATER_THAN));
private List<ILPConstraint> addPredicateConstraints(SRLManager manager, InferenceVariableLexManager variables, Set<String> coreArgs, int predicateId, SRLPredicateInstance x, SRLPredicateStructure y) { String type = manager.getPredictedViewName(); int numCandidates = x.getCandidateInstances().size(); List<ILPConstraint> list = new ArrayList<>(); for (String coreArgument : coreArgs) { int count = 0; int argId = manager.getArgumentId(coreArgument); int[] vars = new int[numCandidates]; double[] coefs = new double[numCandidates]; for (int candidateId = 0; candidateId < numCandidates; candidateId++) { vars[candidateId] = getArgumentVariable(variables, type, predicateId, candidateId, coreArgument); coefs[candidateId] = 1; if (y != null) { if (y.getArgLabel(candidateId) == argId) count++; } } // XXX count == 0 doesn't seem right if (y != null && count < 2) continue; Pair<int[], double[]> cleanedVar = cleanupVariables(vars, coefs); vars = cleanedVar.getFirst(); coefs = cleanedVar.getSecond(); if (vars.length > 0) list.add(new ILPConstraint(vars, coefs, 1.0, ILPConstraint.LESS_THAN)); } return list; }
list.add(new ILPConstraint(vars, coef, 1.0, ILPConstraint.EQUAL));
ILPConstraint constraint = new ILPConstraint(vars, coefs, 0, ILPConstraint.GREATER_THAN);
coefs = pair.getSecond(); ILPConstraint ilpConstraint = new ILPConstraint(vars, coefs, 0, ILPConstraint.GREATER_THAN);
list.add(new ILPConstraint(new int[]{supportVar, cSupportVar}, new double[]{1, 1}, 0, ILPConstraint.EQUAL )); } else { list.add(new ILPConstraint(new int[]{supportVar}, new double[]{1}, 0, ILPConstraint.EQUAL));
constraints.add(new ILPConstraint(clean.getFirst(), clean .getSecond(), 0, ILPConstraint.GREATER_THAN));