Optaplanner / time dependent vehicle routing / considering list of customer operation time windows belonging to activities -
Optaplanner / time dependent vehicle routing / considering list of customer operation time windows belonging to activities -
dear optaplanner users,
i using basis time dependent vehicle routing example. here have removed timewindowed classes, e.g. content of "timewindowedactivity.java" moved , combined "activity.java", , on ...
now add together list of client operation time windows activities. these time windows (number of list items) can different each activity or activities not have such tags @ all. extension should create possible consider activities can performed if fulfilling arrival time lying between number (a list) of client operation time windows, defined by: “customeroperationstarttime” , “customeroperationendtime”.
for solving problem created class "customeroperationtimes.java":
public class customeroperationtimes { private long customeroperationstarttime; private long customeroperationendtime; public long getcustomeroperationstarttime() { homecoming customeroperationstarttime; } public void setcustomeroperationstarttime(long customeroperationstarttime) { this.customeroperationstarttime = customeroperationstarttime; } public long getcustomeroperationendtime() { homecoming customeroperationendtime; } public void setcustomeroperationendtime(long customeroperationendtime) { this.customeroperationendtime = customeroperationendtime; } }
in activity.java added:
private customeroperationtimes customeroperationtimes; private list<customeroperationtimes> customeroperationtimeslist ; public customeroperationtimes getcustomeroperationtimes() { homecoming customeroperationtimes; } public void setcustomeroperationtimes(customeroperationtimes customeroperationtimes) { this.customeroperationtimes = customeroperationtimes; } public list<customeroperationtimes> getcustomeroperationtimeslist() { homecoming customeroperationtimeslist; } public void setcustomeroperationtimeslist(list<customeroperationtimes> customeroperationtimeslist) { this.customeroperationtimeslist = customeroperationtimeslist; }
for testing created xml file single activity:
… <activitylist id="33"> <activity id="34"> <activityid>1</activityid> <activitystatus>101</activitystatus> <location reference="7" /> <appointmentstarttime>1395317700</appointmentstarttime> <!-- unix time in sec => 2014/03/20 12:15:00 --> <appointmentendtime>1395324900</appointmentendtime> <!-- unix time in sec => 2014/03/20 14:15:00 --> <plannedworkduration>4500</plannedworkduration> <!-- in sec => 75min duration --> <customeroperationtimeslist id="100"> <customeroperationtimes id="101"> <customeroperationstarttime>1395317800</customeroperationstarttime> <customeroperationendtime>1395324700</customeroperationendtime> </customeroperationtimes> <customeroperationtimes id="102"> <customeroperationstarttime>1395317800</customeroperationstarttime> <customeroperationendtime>1395324700</customeroperationendtime> </customeroperationtimes> </customeroperationtimeslist> </activity> </activitylist> …
!!! file cannot read , produces exception.
exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: problem reading inputsolutionfile (data\engineerrouting\unsolved\4es_4e_16a_4_8-18s_cot.xml). @ org.optaplanner.persistence.xstream.impl.domain.solution.xstreamsolutionfileio.read(xstreamsolutionfileio.java:66) @ org.optaplanner.examples.common.persistence.xstreamsolutiondao.readsolution(xstreamsolutiondao.java:37) ...
as see, error occurs in file: xstreamsolutiondao.java, when trying read xml input file:
line 37: solution solution = xstreamsolutionfileio.read(inputsolutionfile);
!!! runs next xml content (no list, , “only” 1 customeroperationtimes-tag):
<activitylist id="33"> <activity id="34"> <activityid>1</activityid> <activitystatus>101</activitystatus> <location reference="7" /> <appointmentstarttime>1395317700</appointmentstarttime> <!-- unix time in sec => 2014/03/20 12:15:00 --> <appointmentendtime>1395324900</appointmentendtime> <!-- unix time in sec => 2014/03/20 14:15:00 --> <plannedworkduration>4500</plannedworkduration> <!-- in sec => 75min duration --> <customeroperationtimes id="101"> <customeroperationstarttime>1395317800</customeroperationstarttime> <customeroperationendtime>1395324700</customeroperationendtime> </customeroperationtimes> </activity> </activitylist>
thank suggestions , help.
best regards. milenko
solution:
we added in xml input file:
<customeroperationtimeslist id="110"> <customeroperationtimes id="111"> <id>1</id> <customeroperationstarttime>1395317800</customeroperationstarttime> <customeroperationendtime>1395324700</customeroperationendtime> </customeroperationtimes> <customeroperationtimes id="112"> <id>2</id> <customeroperationstarttime>1395317800</customeroperationstarttime> <customeroperationendtime>1395324700</customeroperationendtime> </customeroperationtimes> </customeroperationtimeslist>
then added class: customeroperationtime.java
:
package com.el2.optimization.technicianrouting.domain; import com.el2.optimization.common.domain.abstractpersistable; import com.el2.optimization.technicianrouting.domain.customeroperationtimes; import com.thoughtworks.xstream.annotations.xstreamalias; import com.thoughtworks.xstream.annotations.xstreaminclude; @xstreamalias("customeroperationtimes") public class customeroperationtimes extends abstractpersistable{ private long customeroperationstarttime; private long customeroperationendtime; public long getcustomeroperationstarttime() { homecoming this.customeroperationstarttime; } public void setcustomeroperationstarttime(long customeroperationstarttime) { this.customeroperationstarttime = customeroperationstarttime; } public long getcustomeroperationendtime() { homecoming this.customeroperationendtime; } public void setcustomeroperationendtime(long customeroperationendtime) { this.customeroperationendtime = customeroperationendtime; } }
in activity.java
added:
private customeroperationtimes customeroperationtimes; // @xmlelement(name = "customeroperationtimeslist", type = customeroperationtimes.class) protected list<customeroperationtimes> customeroperationtimeslist ; @planningentitycollectionproperty @valuerangeprovider(id = "customeroperationtimesrange") public list<customeroperationtimes> getcustomeroperationtimeslist() { homecoming customeroperationtimeslist; } public void setcustomeroperationtimeslist(list<customeroperationtimes> customeroperationtimeslist) { this.customeroperationtimeslist = customeroperationtimeslist; }
this way can read xml file.
optaplanner
Comments
Post a Comment