https://github.com/dlzou/cs170-project
Computing an NP-hard graph problem with simulated annealing.
https://github.com/dlzou/cs170-project
networkx simulated-annealing
Last synced: 3 months ago
JSON representation
Computing an NP-hard graph problem with simulated annealing.
- Host: GitHub
- URL: https://github.com/dlzou/cs170-project
- Owner: dlzou
- Created: 2021-04-18T04:33:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-29T03:35:05.000Z (over 4 years ago)
- Last Synced: 2025-03-11T05:36:01.569Z (7 months ago)
- Topics: networkx, simulated-annealing
- Language: Python
- Homepage:
- Size: 3.31 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CS 170 Project Spring 2021
We competed with other Berkeley students to find the most optimal solutions for a set of inputs to an NP-hard graph problem. The problem can roughly be summarized as follows: given a graph G and two vertices s and t, remove a limited number of vertices and edges from G to maximize the distance of the shortest s-t path.
We wrote a greedy algorithm and a simulated annealing algorithm, as well as several scripts to compute solutions across multiple computers. We reached top 30 overall out of 200+ teams.
## Usage
Run on all inputs:
``` sh
python solver.py
```Run one input:
``` sh
python solver.py path/to/input.in
```Run on one set of inputs (small, medium, or large):
``` sh
python solver.py -- small
```Running on specific number of inputs:
``` sh
python solve_selected.py [num iterations] [size] [list of input numbers, separated by space]
```