1

The optaplanner manual explains how to use the benchmarker to read input files and write the output solutions using XStreamProblemIO.

What i don't understand is how to create the initial input solution file that goes in <inputSolutionFile></inputSolutionFile>. how do i take the solution i generate in my test cases and write that to an xml file? i tried this:

    ActivitySolution activitySolution = createInitialSolution(organization, dateRangeStart, dateRangeEnd);

    // create the dataset xml for benchmark
    ClassLoader classLoader = getClass().getClassLoader();
    URL url = classLoader.getResource("benchmark/testSimpleResourceAllocationAssignment.xml");
    String path = url.getFile();
    File file = new File(path);
    XStreamSolutionFileIO fileIO = new XStreamSolutionFileIO();
    fileIO.write(activitySolution, file);

But am left with an empty file.

I really don't understand how am i supposed to dump my dataset into an xml file.

Thanks

ido flax
  • 528
  • 1
  • 10
  • 19
  • I ran into a similar issue. Mind taking a look at my implementation? http://stackoverflow.com/questions/38155027/unable-to-see-any-results-when-benchmarking-optaplanner – portfoliobuilder Jul 01 '16 at 23:35

1 Answers1

1

Ok i did actually write to the file but in a copy of it in test-classes, so i can confirm that the above code works to write the initial solution to an xml file

ido flax
  • 528
  • 1
  • 10
  • 19
  • 1
    Each java program has a working directory (see run config in IntelliJ/Eclipse) and a benchmark config has a benchmarkDir element (that can be relative to the working directory). – Geoffrey De Smet May 03 '16 at 12:26