Reputation: 1773
I'm trying to use the OptaPlanner Benchmarking module. My benchmark config file is being rejected due to the following error:
The <solver/> element belongs to a different namespace (https://www.optaplanner.org/xsd/benchmark) than expected (https://www.optaplanner.org/xsd/solver).
I took the basics of my config from the example in the docs and I haven't changed any of the xsd / xsi links etc. The example shows tags in the . My IDE doesn't give me any xml formatting errors.
I've paired the file down to just the base section where I define the shared model classes / score definitions and it results in the same problem.
<?xml version="1.0" encoding="UTF-8"?>
<plannerBenchmark xmlns="https://www.optaplanner.org/xsd/benchmark" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.optaplanner.org/xsd/benchmark https://www.optaplanner.org/xsd/benchmark/benchmark.xsd">
<benchmarkDirectory>benchmarks</benchmarkDirectory>
<warmUpSecondsSpentLimit>30</warmUpSecondsSpentLimit>
<inheritedSolverBenchmark>
<solver>
<solutionClass>my.package.SchedulingSolution</solutionClass>
<entityClass>my.package.ISchedulable</entityClass>
<entityClass>my.package.Booking</entityClass>
<scoreDirectorFactory><constraintProviderClass>my.package.SchedulingConstraintProvider</constraintProviderClass></scoreDirectorFactory>
</solver>
</inheritedSolverBenchmark>
I'm invoking it using var benchmarkFactory = PlannerBenchmarkFactory.createFromSolverConfigXmlResource("config-benchmark.xml");
in a main
method.
Am I doing something obviously wrong here?
Upvotes: 1
Views: 139
Reputation: 1029
I think that you are passing the benchmark-config.xml
to the wrong method; createFromSolverConfigXmlResource
expects a solver-config.xml
. It creates a basic benchmark from an existing solver configuration.
In fact, the solver config is a subset of the benchmark config, but they have a separate XML namespace.
Please take a look at the method createFromXmlResource
, which expects the benchmark-config.xml
.
Upvotes: 3