jameson1128
jameson1128

Reputation: 135

How exactly do I import an xml file into Optaplanner to be used in the vehicle routing solution?

I really would like to use Optaplanner for my website to solve the vehicle distribution problem, but I have no idea how to import my database info into the software.

I have a database that I'd like to set up to Optaplanner, but if that is not possible, then I'd like to know how to export my database info into an XML file that can be read by Optaplanner.

Any assistance is appreciated. Thanks

Upvotes: 3

Views: 399

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

OptaPlanner's input and output is not XML, but java objects (POJO's). In the examples, these are persisted to/from XML on disk with the XStreamSolutionDao class, but also persisted to/from various txt formats with the *Importer/Exporter classes.

This means you can copy-paste the examplse and replace the XStreamSolutionDao with your own java implementation that goes to your database.

Also look at the class VehicleRoutingImporter for inspiration.

Upvotes: 1

Related Questions