org.decisiondeck.xmcda_oo.services.utils
Class AssignmentsPerturber

java.lang.Object
  extended by org.decisiondeck.xmcda_oo.services.utils.AssignmentsPerturber

public class AssignmentsPerturber
extends Object

Perturbs assignments. Perturbing an assignment (of an alternative A into a category C1) is transforming it into an assignment of A into a category C2 such that C1 is different than C2.

Requires the possibility of having a superset of categories compared to those where alternatives are indeed assigned.


Constructor Summary
AssignmentsPerturber()
           
 
Method Summary
 void bindTo(IOrderedAssignments assignments)
           
 double getProportionPerturbation()
           
 void perturb()
           Assignments must be bound, the proportion of perturbation must be set.
 void setProportionPerturbation(double propPerturb)
          Sets the proportion of assignments to be perturbed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssignmentsPerturber

public AssignmentsPerturber()
Method Detail

bindTo

public void bindTo(IOrderedAssignments assignments)
Parameters:
assignments - null to unbind.

perturb

public void perturb()
             throws InvalidInputException

Assignments must be bound, the proportion of perturbation must be set.

Perturbs the assignments this object is bound to. The bound assignments are perturbed according to the proportion previously set. The perturbation is done in place. Only if the proportion is zero or rounds to zero will the assignments be unchanged.

Throws:
InvalidInputException - Perturbing assignments having only one category is impossible, in that case and if the proportion to be perturbed leads to perturb at least one assignment (thus does not round to zero), an error is raised. Exception also raised if the bound assignments are multi-categories and at least one assignment must be perturbed: perturbation of multi-categories assignments is not defined.


setProportionPerturbation

public void setProportionPerturbation(double propPerturb)
Sets the proportion of assignments to be perturbed.

Parameters:
propPerturb - a number between zero and one, or a negative number for not set. If zero, perturb will do nothing. If one, every assignments will be perturbed.

getProportionPerturbation

public double getProportionPerturbation()
Returns:
-1 iff not set, otherwise, a number between zero and one.


Copyright © 2011. All Rights Reserved.