@Override public void getInfo(Assignment<V, T> assignment, Model<V, T> model, Map<String, String> info) { if (model.variablesWithInitialValue().size() > 0) info.put( "Perturbations: Total penalty", sDoubleFormat.format(getPerturbationPenalty(assignment, model))); }
@Override public double getPerturbationPenalty(Assignment<V, T> assignment, Model<V, T> model) { double penalty = 0.0; for (V variable : model.variablesWithInitialValue()) { T value = assignment.getValue(variable); if (value != null && variable.getInitialAssignment() != null && !value.equals(variable.getInitialAssignment())) penalty += getPenaltyD(assignment, value, variable.getInitialAssignment()); } return penalty; }
@Override public void setModel(Model<V, T> model) { super.setModel(model); if (model != null) iContextReference = model.createReference(this); }