forked from dhonza/JCOOL
-
Notifications
You must be signed in to change notification settings - Fork 2
QuickStart
dhonza edited this page Mar 30, 2012
·
2 revisions
At first, you have to compile and install JCOOL. Run this in JCOOL root directory:
cd configurations mvn compile mvn install cd .. cd jcool mvn compile mvn install
To start with the GUI, unzip jcool-ui-1.0-SNAPSHOT-distribution.zip found in jcool/ui/target. Operation system specific scripts to run th GUI can be found in bin directory.
The following is a minimal code to run a minimization of a given function:
public static void main(String[] args) { //create a new thread final ExecutorService es = Executors.newSingleThreadExecutor(); //create a new experiment final ExperimentRunner runner = new BasicExperimentRunner(es); //set the function to minimize runner.setFunction(new RosenbrockFunction()); //choose a method runner.setMethod(new QuasiNewtonMethod()); //set solver limited by 1000 iterations runner.setSolver(SolverFactory.getNewInstance(1000)); //start optimization runner.startExperiment(); //get results ExperimentRun run = runner.getExperimentResults(); System.out.println("===================="); System.out.println("Function: " + run.getFunction().getName()); System.out.println("Method: " + run.getMethod().getName()); System.out.println("Solver: " + run.getSolver().getName()); System.out.println("--------------------"); ValuePointTelemetry telemetry = (ValuePointTelemetry) run.getResults().getSolution(); System.out.println("Solution: " + telemetry.getValue().getValue() + " at " + telemetry.getValue().getPoint()); System.out.println("# of iterations: " + run.getResults().getNumberOfIterations()); //let's see, how many function value, gradient and hessian matrix evaluations were needed System.out.println("Statistics: " + run.getResults().getStatistics()); //release the thread es.shutdown(); }