fenzo-core/src/main/java/com/netflix/fenzo/AsSoftConstraint.java
public static VMTaskFitnessCalculator get(final ConstraintEvaluator c) {
        // This fitness calculator return 0 or 1. This can possibly be improved upon by the ConstraintEvaluator using its
        // own logic.
        return new VMTaskFitnessCalculator() {
            @Override
            public String getName() {
                return c.getName();
            }
            @Override
            public double calculateFitness(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
                return c.evaluate(taskRequest, targetVM, taskTrackerState).isSuccessful()? 1.0 : 0.0;
            }
        };
    }
public static VMTaskFitnessCalculator get(final ConstraintEvaluator c) {
        // This fitness calculator return 0 or 1. This can possibly be improved upon by the ConstraintEvaluator using its
        // own logic.
        return new VMTaskFitnessCalculator() {
            @Override
            public String getName() {
                return c.getName();
            }
            @Override
            public double calculateFitness(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
                return c.evaluate(taskRequest, targetVM, taskTrackerState).isSuccessful()? 1.0 : 0.0;
            }
        };
    }
public static VMTaskFitnessCalculator get ( final ConstraintEvaluator c ) { // This fitness calculator return 0 or 1. This can possibly be improved upon by the ConstraintEvaluator using its // own logic. return new VMTaskFitnessCalculator ( ) { @ Override public String getName ( ) { return c . getName ( ) ; } @ Override public double calculateFitness ( TaskRequest taskRequest , VirtualMachineCurrentState targetVM , TaskTrackerState taskTrackerState ) { return c . evaluate ( taskRequest , targetVM , taskTrackerState ) . isSuccessful ( ) ? 1.0 : 0.0 ; } } ; }
Returns a "soft" constraint, in the form of a {@link VMTaskFitnessCalculator}, based on a specified "hard"
constraint, in the form of a {@link ConstraintEvaluator}.

@param c the "hard" constraint to convert
@return a "soft" constraint version of {@code c}
Returns a soft constraint in the form of a { @link VMTaskFitnessCalculator } based on a specified hard constraint in the form of a { @link ConstraintEvaluator } .