Created
December 19, 2013 13:44
-
-
Save edipofederle/8039291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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