@Override public void getConstraintCost(int owner, Assignment k, ConstraintCheckResult result) { KAryConstraint constraint = roots[owner].getConstraint(k); if (constraint == null) { result.set(0, 0); } else { constraint.getCost(k, result); } }
/** * calculate the cost for the given assignment * * @param owner * @param a * @param result */ @Override public void calculateCost(int owner, Assignment a, ConstraintCheckResult result) { List<KAryConstraint> constraintsToConsider = roots[owner].collectAllSubConstraints(a); int cost = 0; int cc = 0; if (constraintsToConsider != null) { for (KAryConstraint constraint : constraintsToConsider) { constraint.getCost(a, result); cost = Agt0DSL.boundedSum(cost, result.getCost()); cc += result.getCheckCost(); } } result.set(cost, cc); }