Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.13-slim

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/

WORKDIR /app

COPY . .

RUN uv venv && uv pip install --no-cache --allow-insecure-host pypi.org --allow-insecure-host files.pythonhosted.org . dwave-neal

ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
# /app → makes `src` importable as a package (for relative imports in app.py)
# /app/src → makes `util` importable as a top-level module
ENV PYTHONPATH=/app:/app/src

EXPOSE 8000

CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "8000"]
2 changes: 1 addition & 1 deletion src/optimizer/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def objective_value(
# Objective: -tr(P_tilde @ X @ A @ X.T)
# Equivalent to -sum_{n,m,s,s'} P_tilde_nm * A_ss' * X_ns * X_ms'
obj = -np.einsum(
"nm,ns,ss',ms'->",
"nm,ns,sk,mk->",
result.P_tilde,
X[:, :-1],
result.A[:-1, :-1].astype(float),
Expand Down
4 changes: 1 addition & 3 deletions src/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from .util import symmetrize_matrix
from .util import mu
from .util import is_valid_solution
from .util import *
2 changes: 1 addition & 1 deletion src/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_real_seat_assignments(X: np.ndarray, S: int) -> np.ndarray:
return real_seats


def get_best_sample(sample_set: SampleSet) -> dimod.sampleset.Sample:
def get_best_sample(sample_set: SampleSet) -> dimod.sampleset.SampleView:
return sample_set.first.sample


Expand Down