-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (54 loc) · 2.67 KB
/
Copy pathMakefile
File metadata and controls
67 lines (54 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Contested-Logistics Routing Optimizer -- common tasks.
#
# Quick start (no Docker):
# make install # editable install with API + dev extras
# make test # run the test suite
# make run # baseline allocation on the sample theater
# make api # frontend at http://localhost:8000/, API docs at /docs
PYTHON ?= python3
DATA ?= data/theater_sample.json
.PHONY: help install test run demo sweep api docker-build docker-run clean \
proto-legibility
help:
@echo "Targets: install | test | run | demo | sweep | api | docker-build | docker-run | clean"
install:
$(PYTHON) -m pip install -e ".[api,dev]"
test:
$(PYTHON) -m pytest -q
# Baseline theater-wide allocation (the headline result).
run:
PYTHONPATH=src $(PYTHON) -m clopt.cli allocate --data $(DATA) --risk-aversion 0
# A guided tour: baseline, a risk-averse plan, the Pareto sweep, and a disruption.
demo:
@echo "== Day 1: the naive plan, and why it cannot be executed =="
PYTHONPATH=src $(PYTHON) -m clopt.cli naive --data $(DATA) --risk-aversion 0
@echo "\n== Baseline allocation (lambda=0) =="
PYTHONPATH=src $(PYTHON) -m clopt.cli allocate --data $(DATA) --risk-aversion 0
@echo "\n== Risk-averse allocation (lambda=25) =="
PYTHONPATH=src $(PYTHON) -m clopt.cli allocate --data $(DATA) --risk-aversion 25
@echo "\n== Cost/risk frontier =="
PYTHONPATH=src $(PYTHON) -m clopt.cli sweep --data $(DATA)
@echo "\n== Max throughput + min-cut certificate (Days 2-3) =="
PYTHONPATH=src $(PYTHON) -m clopt.cli maxflow --data $(DATA)
@echo "\n== Budget interdiction, k=2 (Day 4, NP-hard) =="
PYTHONPATH=src $(PYTHON) -m clopt.cli interdict --data $(DATA) --budget 2
@echo "\n== Under 'strait_mined' threat picture =="
PYTHONPATH=src $(PYTHON) -m clopt.cli allocate --data $(DATA) --threat strait_mined
sweep:
PYTHONPATH=src $(PYTHON) -m clopt.cli sweep --data $(DATA)
# Serves the teaching frontend at / and the API (docs at /docs) from one
# process. Note that --reload does not watch the static assets under
# src/clopt/web -- editing those needs a hard refresh, not a restart.
api:
PYTHONPATH=src CLOPT_DATA=$(DATA) $(PYTHON) -m uvicorn clopt.api:app --reload --host 0.0.0.0 --port 8000
docker-build:
docker build -t clopt:latest .
docker-run:
docker run --rm -p 8000:8000 clopt:latest
# Throwaway prototype for wayfinder #10 - projector legibility of the layer
# catalog. Self-contained page, no server and no dependencies.
proto-legibility:
$(PYTHON) -c "import webbrowser,pathlib; webbrowser.open(pathlib.Path('prototypes/legibility-prototype/index.html').resolve().as_uri())"
clean:
rm -rf build dist *.egg-info src/*.egg-info .pytest_cache
find . -type d -name __pycache__ -prune -exec rm -rf {} +