OptaPlanner benchmark: use in-memory input solution instead of inputSolutionFile -


i'm trying set optaplanner benchmark run. loading problembenchmarks file proving problematic, lot of classes not serializable. take lot of work function.

is there way run benchmark using same unsolved solution use when start normal planner run, constructed existing java code? trivial start benchmark if work somehow.

i find partial solution in optaplanner benchmarking without xml inputsolutionfile.

i able make work, coding implementation of solutionfileio , using static variable pass along unsolved solution has been created.

this works in limited capacity.

is there way set unsolved solution directly on plannerbenchmarkfactory or plannerbenchmark, don't have use static variable?

yes, create text file, example input1.txt empty or contains 1 line identifier. implement solutionfileio

public class machinereassignmentfileio implements solutionfileio<machinereassignment> {      public static final string file_extension = "txt";      @override     public string getinputfileextension() {         return file_extension;     }      @override     public string getoutputfileextension() {         return file_extension;     }      @override     public machinereassignment read(file inputsolutionfile) {         // ignore inputsolutionfile or read id         return ... // create solution manually     }      @override     public void write(machinereassignment solution, file outputsolutionfile) {         throw new unsupportedoperationexception();     }  } 

then configure

<problembenchmarks>   <solutionfileioclass>org...machinereassignmentfileio</solutionfileioclass>   <inputsolutionfile>data/machinereassignment/import/input1.txt</inputsolutionfile>   <problemstatistictype>best_score</problemstatistictype> </problembenchmarks> 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -