vrp
vrp copied to clipboard
Javascript - Solver log and termination criteria
I don't know if it is feasible or not but it would be nice to have solver log in javascript for gaining knowledge on termination criteria and their impact. Of course, I could export the pragmatic problem and run the vrp-cli in the shell with --log option.
I am not an expert in neither rust, javascript, or WebAssembly, but I guess that javascript layer may have some performance impact, that is why I am trying to have a better assessment of the solver results directly in my configuration.
Aside from this log question, I have some doubt about the correct way of passing cost-variation criteria in javascript:
As a string: "costVariation": "200,0.1"?
as an array: "costVariation": [200,0.1]?
In tests, neither options thrown error
Thanks a lot !
Do I understand correctly, that you want to have some callback to report how much is left till termination? If so, at the moment there is no such functionality (but internally it exists for heuristics). Alternative way to gain knowledge about algorithm execution progress post factum is to use telemetry metrics: it is embedded to the solution json. You can enable it via config:
"telemetry": {
"metrics": {
"enabled": true,
"trackPopulation": 1000
}
},
https://github.com/reinterpretcat/vrp/blob/master/examples/data/config/config.full.json#L313-L316
Here is some example how it can be used in the end:
https://github.com/reinterpretcat/vrp-analysis/blob/master/notebooks/analyze_solution.ipynb
Regarding cost variation, there is a configuration example:
"termination": {
"variation": {
"sample": 3000,
"cv": 1
}
}
https://github.com/reinterpretcat/vrp/blob/master/examples/data/config/config.full.json#L301-L304