Loading real world XML problems in OptaPlanner 6.1.0

感情迁移 提交于 2019-12-25 07:15:53

问题


I've been studying the OptaPlanner framwork for a bit and have found the CloudBalancingHelloWorld example fits a problem I'm tasked with fairly well - only it loads a fake generated problem set and I'd like to create my own XML file and load that instead ... but the docs seem a bit sparse on this subject, and I don't see any examples.

The existing code in CloudBalancingHellowWorld.java is:

// Load a problem with 400 computers and 1200 processes
// This gets replaced with a class that loads a *real* problem - from a DB for example.
CloudBalance unsolvedCloudBalance = new CloudBalancingGenerator().createCloudBalance(400, 1200);

And I'd like to be able to programmatically load an XML problem description. Are there any examples out there of this being done or Docs to be perused to gain some inspiration?


回答1:


The whole dataset serialization from and to XML is part of optaplanner-examples: OptaPlanner itself doesn't provide or require any serialization format. That being said, optaplanner-examples includes the following serialization formats:

  • Every example: XStream XML format in data directories unsolved and solved. The format is defined by the XStream annotations (@XStreamAlias etc) on the domain classes. In some cases the XML format is too verbose, causing OutOfMemoryError, for example for the big MachineReassignment B datasets.
  • Most examples: Competition specific TXT format in data directories import and export. The format is defined by the competition (see docs). In the examples GUI, click on button Import to load them.


来源:https://stackoverflow.com/questions/25636540/loading-real-world-xml-problems-in-optaplanner-6-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!