2016-07-01 3 views
0

J'ai besoin d'aide pour l'analyse comparative en utilisant OptaPlanner. Il y a deux problèmes que je rencontre. Le premier est de voir les résultats de l'analyse comparative des exemples fournis. Je vois que l'exemple du véhicule a deux applications. L'un d'eux est "VehicleRoutingBenchmarkApp". J'ai couru cette application et j'ai pensé que l'index.html serait généré mais ce n'était pas le cas. Donc, je ne suis pas clair sur la façon de faire cela.Comment travailler Exécuter/implémenter Benchmark pour optaplanner?

Le deuxième problème est l'implémentation. J'expérimente juste, donc j'ai ajouté l'extrait de code comme indiqué par la documentation dans le principal VehicleRoutingApp() afin que je puisse voir ce qui se produira.

lien Documentation: https://docs.jboss.org/drools/release/6.0.0.CR3/optaplanner-docs/html/benchmarkingAndTweaking.html

System.out.println("-------------- benchmark stuff --------------"); 
     PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(
       "org/optaplanner/examples/vehiclerouting/benchmark/vehicleRoutingBenchmarkConfig.xml"); 
     PlannerBenchmark plannerBenchmark = plannerBenchmarkFactory.buildPlannerBenchmark(); 
     plannerBenchmark.benchmark(); 

Le résultat fut un flux constant de journaux émis. Il est difficile de suivre ce qui est transmis. Comment puis-je obtenir tout cela traduit dans une belle interface graphique comme je crois que l'index.html est supposé faire? Merci d'avance.

Le tracestack Je reçois est la suivante:

Exception in thread "main" java.lang.IllegalStateException: The directory dataDir (C:\Intellij\Workspace\optaplanner-developer\data\vehiclerouting) does not exist. 
Either the working directory should be set to the directory that contains the data directory (which is not the data directory itself), or the system property org.optaplanner.examples.dataDir should be set properly. 
The data directory is different in a git clone (optaplanner/optaplanner-examples/data) and in a release zip (examples/sources/data). 
In an IDE (IntelliJ, Eclipse, NetBeans), open the "Run configuration" to change "Working directory" (or add the system property in "VM options"). 
    at org.optaplanner.examples.common.persistence.AbstractSolutionDao.<init>(AbstractSolutionDao.java:46) 
    at org.optaplanner.examples.common.persistence.XStreamSolutionDao.<init>(XStreamSolutionDao.java:32) 
    at org.optaplanner.examples.vehiclerouting.persistence.VehicleRoutingDao.<init>(VehicleRoutingDao.java:25) 
    at org.optaplanner.examples.vehiclerouting.persistence.VehicleRoutingImporter.<init>(VehicleRoutingImporter.java:57) 
    at org.optaplanner.examples.vehiclerouting.persistence.VehicleRoutingFileIO.<init>(VehicleRoutingFileIO.java:28) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
    at java.lang.Class.newInstance(Class.java:442) 
    at org.optaplanner.core.config.util.ConfigUtils.newInstance(ConfigUtils.java:46) 
    at org.optaplanner.benchmark.config.ProblemBenchmarksConfig.buildSolutionFileIO(ProblemBenchmarksConfig.java:149) 
    at org.optaplanner.benchmark.config.ProblemBenchmarksConfig.buildProblemBenchmarkList(ProblemBenchmarksConfig.java:111) 
    at org.optaplanner.benchmark.config.SolverBenchmarkConfig.buildSolverBenchmark(SolverBenchmarkConfig.java:88) 
    at org.optaplanner.benchmark.config.PlannerBenchmarkConfig.buildPlannerBenchmark(PlannerBenchmarkConfig.java:210) 
    at org.optaplanner.benchmark.impl.XStreamXmlPlannerBenchmarkFactory.buildPlannerBenchmark(XStreamXmlPlannerBenchmarkFactory.java:156) 
    at org.optaplanner.examples.common.app.CommonBenchmarkApp.buildAndBenchmark(CommonBenchmarkApp.java:68) 
    at org.optaplanner.examples.vehiclerouting.app.VehicleRoutingBenchmarkApp.main(VehicleRoutingBenchmarkApp.java:24) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
+1

'VehicleRoutingBenchmarkApp' de la boîte doit travailler. Assurez-vous qu'il est exécuté avec le répertoire de travail défini sur 'optaplanner-examples' (par défaut dans IntelliJ, mais pas dans Eclipse). Copiez coller le stacktrace ici si ce n'est pas le cas. –

Répondre

1

Pour ceux qui essaient d'apprendre optaplanner et a la même question, la solution est dans votre fichier benchmarkConfig.xml référencé. Vous devez créer un fichier XML ayant une racine <plannerBenchmark>. A l'intérieur de cela, vous pouvez ajouter un autre tag appelé <benchmarkDiretory>. C'est ici que vous pouvez spécifier où vous voulez que votre rapport soit généré. Veillez à définir votre <inputSolutionFile> pour qu'il pointe vers les ensembles de données appropriés, qui peuvent être .xml ou .vrp. Le reste fonctionne comme de la magie.

devrait ressembler à quelque chose de semblable à ce qui suit:

<plannerBenchmark> 
    <benchmarkDirectory>local/data/report/vehiclerouting</benchmarkDirectory> 
    ..... 
    <inputSolutionFile>data/vehiclerouting/unsolved/TestCase_1.xml</inputSolutionFile> 
    ..... 
</plannerBenchmark>