CLI adjustments
This commit is contained in:
parent
3358a469a3
commit
7605dacb8a
@ -1,12 +1,19 @@
|
|||||||
package eva2.cli;
|
package eva2.cli;
|
||||||
|
|
||||||
import eva2.OptimizerFactory;
|
|
||||||
import eva2.optimization.go.InterfaceOptimizationParameters;
|
import eva2.optimization.go.InterfaceOptimizationParameters;
|
||||||
import eva2.optimization.modules.OptimizationParameters;
|
import eva2.optimization.individuals.InterfaceDataTypeDouble;
|
||||||
|
import eva2.optimization.operator.terminators.InterfaceTerminator;
|
||||||
import eva2.optimization.statistics.InterfaceStatisticsParameters;
|
import eva2.optimization.statistics.InterfaceStatisticsParameters;
|
||||||
|
import eva2.optimization.strategies.InterfaceOptimizer;
|
||||||
|
import eva2.problems.InterfaceOptimizationProblem;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by becker on 01.11.2014.
|
*
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@ -14,10 +21,37 @@ public class Main {
|
|||||||
InterfaceOptimizationParameters parameters = OptimizationBuilder.parseOptimizerArguments(args);
|
InterfaceOptimizationParameters parameters = OptimizationBuilder.parseOptimizerArguments(args);
|
||||||
InterfaceStatisticsParameters statisticsParameters = OptimizationBuilder.parseStatisticsArguments(args);
|
InterfaceStatisticsParameters statisticsParameters = OptimizationBuilder.parseStatisticsArguments(args);
|
||||||
|
|
||||||
|
InterfaceTerminator terminator = parameters.getTerminator();
|
||||||
|
InterfaceOptimizer optimizer = parameters.getOptimizer();
|
||||||
|
InterfaceOptimizationProblem problem = parameters.getProblem();
|
||||||
|
|
||||||
double[] result = OptimizerFactory.optimizeToDouble((OptimizationParameters)parameters);
|
OutputStream fileStream = null;
|
||||||
|
try {
|
||||||
|
fileStream = new FileOutputStream("derp.yml");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println(ex.getMessage());
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
optimizer.addPopulationChangedEventListener(new OptimizationLogger(parameters, fileStream));
|
||||||
|
for (int i = 0; i < statisticsParameters.getMultiRuns(); i++) {
|
||||||
|
|
||||||
|
problem.initializeProblem();
|
||||||
|
problem.initializePopulation(optimizer.getPopulation());
|
||||||
|
|
||||||
|
optimizer.setProblem(problem);
|
||||||
|
terminator.initialize(problem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the main optimization loop. We keep calling
|
||||||
|
* optimize() until a termination criterion is met or
|
||||||
|
* the user aborts the optimization manually.
|
||||||
|
*/
|
||||||
|
do {
|
||||||
|
optimizer.optimize();
|
||||||
|
} while (!terminator.isTerminated(optimizer.getAllSolutions()));
|
||||||
|
|
||||||
|
System.out.println(Arrays.toString(((InterfaceDataTypeDouble)optimizer.getPopulation().getBestEAIndividual()).getDoubleData()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,6 @@ public final class OptimizationBuilder {
|
|||||||
for (String key : argumentMap.keySet()) {
|
for (String key : argumentMap.keySet()) {
|
||||||
insertIntoArgumentTree(argumentTree, key, argumentMap.get(key));
|
insertIntoArgumentTree(argumentTree, key, argumentMap.get(key));
|
||||||
}
|
}
|
||||||
System.out.println(argumentTree.toString());
|
|
||||||
|
|
||||||
return argumentTree;
|
return argumentTree;
|
||||||
}
|
}
|
||||||
@ -150,7 +149,6 @@ public final class OptimizationBuilder {
|
|||||||
if (getter == null || setter == null || setter.isAnnotationPresent(Hidden.class)) {
|
if (getter == null || setter == null || setter.isAnnotationPresent(Hidden.class)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
System.out.println(name + " = " + " type = " + type);
|
|
||||||
|
|
||||||
// We use the name of the descriptor or if possible
|
// We use the name of the descriptor or if possible
|
||||||
// one that is given by the @Parameter annotation.
|
// one that is given by the @Parameter annotation.
|
||||||
|
@ -238,47 +238,11 @@ public class JMatLink extends Thread {
|
|||||||
// ************** load JMatLink library into memory **********************
|
// ************** load JMatLink library into memory **********************
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// System.out.println("loading !!");
|
try {
|
||||||
try { // System.out.println("loading");
|
|
||||||
|
|
||||||
System.loadLibrary("JMatLink");
|
System.loadLibrary("JMatLink");
|
||||||
|
} catch (UnsatisfiedLinkError ignored) {
|
||||||
// String
|
|
||||||
// path="../lib/"+SystemHelper.getOperationSystemName()+"/JMatLink.dll";
|
|
||||||
|
|
||||||
// System.out.println("load: "+path);
|
|
||||||
|
|
||||||
// System.loadLibrary(path);
|
|
||||||
|
|
||||||
// String libPath = "." + System.getProperty("file.separator", "/");
|
|
||||||
|
|
||||||
// //libPath += SystemHelper.getOperationSystemName() +
|
|
||||||
// System.getProperty("file.separator", "/");
|
|
||||||
|
|
||||||
// libPath += System.mapLibraryName("JMatLink");
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// // make sure that we have the absolute path
|
|
||||||
|
|
||||||
// libPath = new File(libPath).getAbsolutePath();
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// System.out.println("load: "+"d:/workingAt/JCompChem/lib/windows/JMatLink.dll");
|
|
||||||
|
|
||||||
// System.loadLibrary("../lib/windows/JMatLink_old.dll");
|
|
||||||
|
|
||||||
// System.out.println("loaded");
|
|
||||||
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
|
||||||
|
|
||||||
System.err.println("ERROR: Could not load the JMatLink library");
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// System.out.println("loading !! end");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user