Home

Awesome

Neural Rewriter

This repo provides the code to replicate the experiments in the paper

Xinyun Chen, Yuandong Tian, <cite> Learning to Perform Local Rewriting for Combinatorial Optimization, in NeurIPS 2019. </cite>

Paper [arXiv]

Prerequisites

PyTorch

Tasks

Expression Simplification

For expression simplification, given an initial expression (in Halide for our evaluation), the goal is to find an equivalent expression that is simplified, e.g., with a shorter length.

Performance

Expression Simplification

We compare our approach (NeuRewriter) with the following baselines:

In the figure, Average expression length reduction is the decrease of the length defined as the number of characters in the expression, and Average tree size reduction is the number of nodes decreased from the initial expression parse tree to the rewritten one.

Dataset

We generate expressions in Halide using a random pipeline generator. We obtain rewriting traces using the Halide rule-based rewriter here.

Usage

The code includes the implementation of following approaches:

Job Scheduling

For job scheduling, we have a machine with D types of resources, and a queue that can hold at most W=10 pending jobs. Each job arrives in an online fashion, with a fixed resource demand and the duration. The goal is to minimize the average slowdown (Cj - Aj) / Tj, where Cj is the completion time of job j, Aj is the arrival time, and Tj is the job duration.

Performance

Job Scheduling

We compare our approach (NeuRewriter) with the following baselines:

In the figure, D denotes the number of resource types.

Dataset

The dataset generator can be found under this folder.

Usage

The code includes the implementation of following approaches:

Vehicle Routing

For vehicle routing, we have a single vehicle with limited capacity to satisfy the resource demands of a set of customer nodes. To do so, we need to construct multiple routes starting and ending at the depot, so that the resources delivered in each route do not exceed the vehicle capacity, while the total route length is minimized.

Performance

Vehicle Routing

We compare our approach (NeuRewriter) with the following baselines:

In the figure, VRP X, CAP Y means that the number of customer nodes is X, and the vehicle capacity is Y.

Dataset

The dataset generator can be found under this folder.

Usage

Run run_vrp.py.

Run experiments

In the following we list some important arguments for experiments using neural network models:

More details can be found in arguments.py.

Citation

If you use the code in this repo, please cite the following paper:

@inproceedings{chen2019learning,
  title={Learning to Perform Local Rewriting for Combinatorial Optimization},
  author={Chen, Xinyun and Tian, Yuandong},
  booktitle={Advances in Neural Information Processing Systems},
  year={2019}
}

License

This repo is CC-BY-NC licensed, as found in the LICENSE file.

References

[1] Z3

[2] Halide

[3] OR-tools

[4] Mao et al. Resource Management with Deep Reinforcement Learning. ACM HotNets 2016

[5] Wren and Holliday. Computer scheduling of vehicles from one or more depots to a number of delivery points. Operational Research Quarterly, 1972.

[6] Clarke and Wright. Scheduling of vehicles from a central depot to a number of delivery points. Operations research, 1964.

[7] Nazari et al. Reinforcement Learning for Solving the Vehicle Routing Problem. NeurIPS 2018.

[8] Kool et al. Attention, Learn to Solve Routing Problems! ICLR 2019.