mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
adjusted label to indicate multiple cap dims
This commit is contained in:
parent
265fa64497
commit
f446874758
1 changed files with 20 additions and 2 deletions
|
|
@ -84,7 +84,7 @@ public class Plotter {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(SolutionPlotter.class);
|
private static Logger log = Logger.getLogger(Plotter.class);
|
||||||
|
|
||||||
|
|
||||||
public static enum Label {
|
public static enum Label {
|
||||||
|
|
@ -465,13 +465,31 @@ public class Plotter {
|
||||||
|
|
||||||
private void addLabel(Map<XYDataItem, String> labels, Job job, XYDataItem dataItem) {
|
private void addLabel(Map<XYDataItem, String> labels, Job job, XYDataItem dataItem) {
|
||||||
if(this.label.equals(Label.SIZE)){
|
if(this.label.equals(Label.SIZE)){
|
||||||
labels.put(dataItem, String.valueOf(job.getCapacityDemand()));
|
labels.put(dataItem, getSizeString(job));
|
||||||
}
|
}
|
||||||
else if(this.label.equals(Label.ID)){
|
else if(this.label.equals(Label.ID)){
|
||||||
labels.put(dataItem, String.valueOf(job.getId()));
|
labels.put(dataItem, String.valueOf(job.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getSizeString(Job job) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("(");
|
||||||
|
boolean firstDim = true;
|
||||||
|
for(int i=0;i<job.getSize().getNuOfDimensions();i++){
|
||||||
|
if(firstDim) {
|
||||||
|
builder.append(String.valueOf(job.getSize().get(i)));
|
||||||
|
firstDim = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
builder.append(",");
|
||||||
|
builder.append(String.valueOf(job.getSize().get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.append(")");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private XYSeriesCollection makeVrpSeries(VehicleRoutingProblem vrp, Map<XYDataItem, String> labels) throws NoLocationFoundException{
|
private XYSeriesCollection makeVrpSeries(VehicleRoutingProblem vrp, Map<XYDataItem, String> labels) throws NoLocationFoundException{
|
||||||
return makeVrpSeries(vrp.getVehicles(), vrp.getJobs().values(), labels);
|
return makeVrpSeries(vrp.getVehicles(), vrp.getJobs().values(), labels);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue