Ptolomeo XII
Ptolomeo XII

Reputation: 105

Optaplanner: Howto change the sample XML in the nurserostering demo?

I am stucked with the Nurserostering example in Optaplanner. I would like to change the input XML to play around (for example increase the number of nurses from 30 to 100), and I find it's very complicated to manually edit it, so I think there must be some kind of 'generator', or maybe I should make my own 'XML generator'.

For example I see every node in the sample has a unique id, so if I want to increase the number of nurses, it's not as simple as copying the last Employee node and pasting it 70 times; I should check every id inside and increase it accordingly.

<Employee id="358">
  <id>6</id>
  <code>6</code>
  <name>6</name>
  <contract reference="36"/>
  <dayOffRequestMap id="359">
    <entry>
      <ShiftDate reference="183"/>
      <DayOffRequest id="360">
        <id>18</id>
        <employee reference="358"/>
        <shiftDate reference="183"/>
        <weight>1</weight>
      </DayOffRequest>
      ...

Therefore, I ask, is there any method to generate this (or other) XML?

Upvotes: 0

Views: 126

Answers (2)

lacroixca
lacroixca

Reputation: 71

You looked at the wrong XML file! Instead of taking e.g. data/nurserostering/unsolved/medium01.xml, take data/nurserostering/import/medium01.xml.

<Employees>
  <Employee ID="0">
    <ContractID>0</ContractID>
    <Name>0</Name>
    <Skills>
      <Skill>Nurse</Skill>
    </Skills><
  </Employee>
[...]

<DayOffRequests>
  <DayOff weight="1">
    <EmployeeID>0</EmployeeID>
    <Date>2010-01-21</Date>
  </DayOff>
[...]

This file can then easily be edited and imported in OptaPlanner.

Upvotes: 1

the.wizard
the.wizard

Reputation: 1109

The best way I could think of is write a small java application where you could load the original dataset, and then add any number of employees you want (using java code of course). At least this is what I do when I need a bigger dataset or when I toy around the model data (because the dataset need to be updated too).

Oh I almost forgot, sometimes I use xml viewer to help me do some manual copy and paste work (it help me a lot since the row is thousand lines).

Upvotes: 1

Related Questions