Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created December 19, 2013 13:44
Show Gist options
  • Save edipofederle/8039291 to your computer and use it in GitHub Desktop.
Save edipofederle/8039291 to your computer and use it in GitHub Desktop.
public Object execute(Object object) throws JMException {
Solution solution = (Solution) object;
Double probability = (Double) getParameter("probability");
Architecture clone = null;
try {
clone = ((Architecture) solution.getDecisionVariables()[0]).deepClone();
} catch (CloneNotSupportedException e1) {
e1.printStackTrace();
}
if (probability == null) {
Configuration.logger_.severe("FeatureMutation.execute: probability not specified");
java.lang.Class<String> cls = java.lang.String.class;
String name = cls.getName();
throw new JMException("Exception in " + name + ".execute()");
}
try {
this.doMutation(mutationProbability_, solution);
} catch (Exception e) {
e.printStackTrace();
}
if(!this.isValidSolution(((Architecture) solution.getDecisionVariables()[0]))){
solution.getDecisionVariables()[0] = null;
solution.getDecisionVariables()[0] = clone;
OPLA.contDiscardedSolutions_++;
}
return solution;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment