ChanBong / gshp_optimization

1 stars 1 forks source link

GS_HP Optimisation

File Structure

Folders

Files

Flask API

There is an endpoint for each model that we are using.

Input to any endpoint is a json file with following fields

{
    instance_name: "name_of_the_instance",
    instance_seed: "seed_for_the_instance",
    solver_seed: "seed_for_the_solver",
    epoch_tlim: "time_limit_for_each_epoch",
    config_loc: "configs/solver.toml",
    profile: True,
    static: "boolean_value_wheater_we_want_to_solve_static_or_dynamic",
    hindsight: False
}

Output

routes:[
    {
        locationID1: 1
        locationID2: 2
        distance: "distance_travelled_by_the_rider"
    }
]

Solver

Our static solver is based on the hybrid genetic search baseline we received as part of the quickstart code here. We have refactored this solver significantly, making it much more modular and more performant. We also:

Our dynamic strategy (simulate) simulates requests from future epochs. In each epoch, we simulate multiple scenarios and quickly solve the resulting simulation instances using the static solver (in a few hundred milliseconds). We use the simulation solutions to determine which requests to postpone, and which to dispatch. In particular, we postpone a request if it was infrequently paired with must-dispatch requests, otherwise we dispatch it. We then solve the resulting dispatch instance, again using the static solver. We also:

Finally, we tuned the static and dynamic parameters in several large-scale numerical experiments.

How to use

First, one needs to install the required poetry dependencies:

poetry install

Make local folders for solutions and logs

mkdir solutions logs

I have already compliled the static and dynamic solver. If we make some changes in C++, then one needs to compile the static solver. Assuming the pybind submodule has been initialised, and cmake is available, the following should work:

cmake -Brelease -Shgs_vrptw -DCMAKE_BUILD_TYPE=Release
make --directory=release

Then, the solver (both static and dynamic) can be called using the solver.py script.

python3 solver.py --epoch_tlim 5 --static --instance instances/toy_vrp.txt --profile

This doesn't work currently. It is easiest to run this via the controller.py script, as (e.g.):

python controller.py --instance instances/ORTEC-VRPTW-ASYM-0bdff870-d1-n458-k35.txt --epoch_tlim 5 -- python solver.py

This runs the solver on the given dynamic instance, with a 5s time limit per epoch. Solving the static instance is achieved by also passing in the --static flag. Additional command line options are available, and can be found in the respective scripts.

We also offer several standalone scripts running multiple instances in parallel, which is useful for benchmarking. These scripts are:

Finally, for tuning, we used the make_dynamic_parameters.py and make_static_parameters.py scripts. These produce configuration files that can be passed into any of the other scripts mentioned above. To run the tuning scripts, the optional tune dependency group should be installed, using:

poetry install --only tune

TODO

App interaction

OR Optimisation

ML Optimisation