Add new Artificial Bee Optimizer

Refactor method name and fix typos.
Implement partial cli optimizer selection.
This commit is contained in:
2013-12-09 15:19:48 +01:00
parent 493b96fa68
commit 7a7f8f0d67
6 changed files with 135 additions and 14 deletions

View File

@@ -225,9 +225,38 @@ public class Main implements OptimizationStateListener, InterfacePopulationChang
if (commandLine.hasOption("optimizer")) {
String optimizerName = commandLine.getOptionValue("optimizer");
try {
createOptimizerFromName(optimizerName, optimizerParams);
} catch(Exception ex) {
System.out.println(ex.getMessage());
System.exit(-1);
}
}
}
/**
* This method will create the various optimizers that are supported on the CLI.
* It's a really messy process since neither Java nor args4j/apache-cli can handle
* complex object parameters. The trick here is that all parameters after the
* double-dash (--) are treated as parameters for the optimization algorithm.
*
* @param optimizerName The name of the optimizer.
* @param optimizerParams The remaining command line parameters.
* @throws Exception
*/
private void createOptimizerFromName(String optimizerName, String[] optimizerParams) throws Exception {
Options opt = new Options();
switch(optimizerName) {
case "DifferentialEvolution":
System.out.println("DE");
opt.addOption("-F", true, "Differential Weight");
opt.addOption("-CR", true, "Crossover Rate");
opt.addOption("-DEType", true, "DE Type (");
break;
default:
throw new Exception("Unsupported Optimizer");
}
}
private void setProblemFromName(String problemName) {