Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
b9a657e
basic setup without solvers
zaibod Apr 14, 2025
bb609f4
refactor: renamed package and classes
zaibod Apr 15, 2025
e242fc3
feat: added h2 example
zaibod Apr 24, 2025
c0bbefa
basic setup without solvers
zaibod Apr 14, 2025
a924300
refactor: renamed package and classes
zaibod Apr 15, 2025
6db3bee
feat: added h2 example
zaibod Apr 24, 2025
e803a09
Merge pull request #140 from ProvideQ/main
koalamitice May 8, 2025
a2dd3ac
Merge branch 'feat/quantum-material-simulation-mask' of https://githu…
zaibod May 8, 2025
7639f1a
feat: added java wrapper for python materialsimulation solver
zaibod May 8, 2025
130539b
feat: added qiskit material simulation solver to application properties
zaibod May 8, 2025
2cc4b70
fix: renamed for consistency and added annotation
zaibod May 8, 2025
3ece97c
feat: added qiskit solver to material simulation config
zaibod May 8, 2025
51c63c9
feat: added qiskit material simulation solver
zaibod May 8, 2025
7316f19
Merge branch 'feat/quantum-material-simulation-mask' of https://githu…
zaibod May 8, 2025
c1df695
fix: fixed app prop passing
zaibod May 12, 2025
f5da10c
fix: change argument type to ensure corrrect order
zaibod May 13, 2025
864e445
fix: add correct dependencies
zaibod May 13, 2025
28bf7bb
fix: fixed python script bugs
zaibod May 13, 2025
b5cacfd
fix: fixed wrong argument name
zaibod May 15, 2025
c1a1826
feat: added material simulation test
zaibod May 15, 2025
a5a3aca
chore: fixed overly long line
zaibod May 15, 2025
f8fa019
chore: fixed checkstyle
zaibod May 15, 2025
fff9af9
chore: fixed dependency version
zaibod May 20, 2025
9e989ad
feat: added molecule charge and spin as parameters to script
zaibod May 27, 2025
60fdfde
feat: added molecule charge and spin as solver settings
zaibod May 27, 2025
44fc5c0
Merge pull request #141 from ProvideQ/feat/quantum-material-simulatio…
Elscrux May 27, 2025
d1ddd16
add: citation file
koalamitice Jul 15, 2025
7ff0c17
Update copyright year in README.md
zaibod Oct 13, 2025
55cee69
added debug echos to track error
zaibod Oct 29, 2025
a93b919
debug: add debug echos to gams setup
zaibod Nov 18, 2025
0917fe0
debug: removed "quiet" parameter from gams installer
zaibod Nov 18, 2025
93a7b8d
feat: update GAMS version to 49.7 in setup script to replace unavaila…
zaibod Nov 19, 2025
9aa40f9
debug: re-enabled quiet flag for GAMS installation, more debug echos
zaibod Nov 19, 2025
c6ce483
debug: fix debug echo statement in CI/CD workflow
zaibod Nov 19, 2025
b9d3e92
refactor: clean up debug messages in setup-gams.sh
zaibod Nov 19, 2025
58c4e1a
fix: remove debug echo statements from CI/CD script
zaibod Nov 19, 2025
8745e0e
fix: upgraded qiskit versions
zaibod Nov 20, 2025
b209a30
fix: add overlooked sympy dependency for qrisp
zaibod Nov 20, 2025
c40c0e6
fix: update Qiskit optimizer import paths
zaibod Nov 20, 2025
b0ad49b
fix: removed explicit qiskit import
zaibod Nov 27, 2025
a07ff7b
fix: readded downgraded qiskit version
zaibod Nov 27, 2025
9077c87
fix: fixed material simulation dependency versions
zaibod Dec 3, 2025
80bb8d9
fix: used newer version of gurobipy
zaibod Jan 14, 2026
95cf3e7
Update copyright year to 2026
Elscrux Jan 15, 2026
def7748
Merge pull request #145 from ProvideQ/fix/pipeline
Elscrux Jan 15, 2026
597ce0c
feat: Add description to ProblemType
Elscrux May 27, 2025
85e25be
feat: Create GET /problems endpoint
Elscrux May 27, 2025
6575907
feat: Change ProblemSolver id to simple class name
Elscrux May 27, 2025
e9e51ed
feat: Add validator to ensure that no ProblemSolver class names are t…
Elscrux May 27, 2025
60632b3
refactor: change problem type ids to UpperCamelCase
Elscrux May 27, 2025
853e2ba
feat: filter demonstrator problem type in /problems endpoint
Elscrux May 27, 2025
97f2634
fix: Make /problems GET endpoint
Elscrux Jun 5, 2025
0d31141
feat: add flag for subroutine definitions to define if the subroutine…
Elscrux Jul 1, 2025
200c6d1
refactor: change /problems to /problem-types and add /problem-types/P…
Elscrux Jul 1, 2025
d3afd25
feat: add problem attributes
Elscrux Jul 1, 2025
a8feabd
fix: add missing description for material simulation
Elscrux Jul 1, 2025
b317ffc
refactor: rename sat attribute or_clause_count to clause_count
Elscrux Jul 15, 2025
0bdf0c1
refactor: use PascalCase for problem type
Elscrux Nov 7, 2025
484b583
feat: add dimension and capacity attributes to vrp problems
Elscrux Nov 7, 2025
8c83055
refactor: problem bound structure
zaibod Feb 17, 2025
33c850c
refactor: add hasBound method to ComparisonDto
zaibod Jun 30, 2025
8dfced5
refactor: added docs and small refactors
zaibod Jun 30, 2025
477e59a
refactor: rename ComparisonDto to BoundComparisonDto
Elscrux Jan 29, 2026
e398fea
refactor: make boundWithComparison non-final
Elscrux Jan 29, 2026
0143a8d
fix: duplicate setBound method confusing spring which one to choose
Elscrux Jan 29, 2026
66e3c50
docs: add solutionPattern javadocs
Elscrux Jan 29, 2026
5e14f64
Merge pull request #143 from ProvideQ/refactor/problem-bound-structure
Elscrux Jan 29, 2026
9d91a1a
docs: add docs for isCalledOnlyOnce
Elscrux Feb 5, 2026
debf4cf
docs: add SolverClassNameValidator docs
Elscrux Feb 5, 2026
ec56469
chore: remove too long line
Elscrux Feb 5, 2026
dc30167
Merge branch 'develop' into feat/problems-endpoint
Elscrux Feb 5, 2026
b3d2605
Merge pull request #146 from ProvideQ/feat/problems-endpoint
koalamitice Feb 5, 2026
9d5f0d7
chore: adjust to new application.properties layout
Elscrux Apr 22, 2025
0ed292f
feat: Add molecule energy simulator
Elscrux Feb 10, 2025
e6eb5e5
refactor: Rename from hydrogen to molecule energy
Elscrux Feb 13, 2025
dcfeaf4
feat: Add note about molecule format
Elscrux Feb 13, 2025
471fbaa
feat: Add molecule energy demonstrator description
Elscrux Feb 13, 2025
9824832
chore: Change arguments to singular argument
Elscrux Mar 6, 2025
add7460
chore: Use updated application.properties and venv
Elscrux Apr 22, 2025
e82c139
refactor: Move requirements.txt to solver directory to follow the new…
Elscrux Apr 22, 2025
2d0521e
chore: Remove unused imports
Elscrux Apr 29, 2025
45c8311
chore: Change exception type
Elscrux Apr 29, 2025
24f5340
chore: Move imports up
Elscrux May 6, 2025
5666829
chore: fixate python requirement versions based on report in https://…
Elscrux May 30, 2025
03df7f6
chore: remove redundant assignment of optimizer
Elscrux May 30, 2025
0c41bf5
test: adapt CplexMipDemonstratorTest to general DemonstratorTest
Elscrux May 30, 2025
544c31b
chore: remove old debug command
Elscrux Jun 3, 2025
5e78b31
fix: put molecule argument in quotes
Elscrux Jun 3, 2025
e124884
chore: update build file to remove syntax deprecated in gradle v9
Elscrux Jun 3, 2025
bd6a8f7
feat: add detailed report of used arguments
Elscrux Jun 3, 2025
3730ba4
fix: remove prints from script as they also end up in the solution re…
Elscrux Jun 3, 2025
2811a1f
test: increase timeout of timeouted tests
Elscrux Jun 3, 2025
01eff0b
Merge pull request #131 from ProvideQ/feat/demonstrator/hydrogen
koalamitice Feb 5, 2026
adcad8d
feat: update citation
Elscrux Feb 5, 2026
cbcd886
Merge pull request #148 from ProvideQ/feat/citation
koalamitice Feb 5, 2026
7415d15
udpate game version
koalamitice Feb 13, 2026
250cb35
added debug prints to testcases
koalamitice Feb 13, 2026
a177492
fixed checkstyle error (lines too long)
koalamitice Feb 13, 2026
b4ea979
fix: replace print with println
Elscrux Feb 13, 2026
e9c16e6
Merge pull request #149 from ProvideQ/fix/gams-update
Elscrux Feb 13, 2026
c25efe7
fix: new commands to install compilers that might be needed for solve…
koalamitice Feb 19, 2026
3e23e71
udpate game version
koalamitice Feb 13, 2026
c139a1a
added debug prints to testcases
koalamitice Feb 13, 2026
fa901d8
fixed checkstyle error (lines too long)
koalamitice Feb 13, 2026
a54c9b9
fix: replace print with println
Elscrux Feb 13, 2026
27cb4dc
Merge pull request #150 from ProvideQ/fix/ci-pipeline-wheel
koalamitice Feb 19, 2026
cb6f53c
fix: moved install command to the correct location (in Dockerfile not…
koalamitice Feb 19, 2026
3c852e3
fix: added info tag to gradle check command in CI runner for better t…
koalamitice Feb 20, 2026
9e8647f
Merge pull request #151 from ProvideQ/fix/ci-pipeline-wheel
koalamitice Feb 20, 2026
b64d0db
feat: add dimension attribute to tsp
Elscrux Apr 27, 2026
4ab5fe0
feat: add gams qubo solver
Elscrux Jun 2, 2026
f36d4b7
feat: change python3 to python in venv setup script
Elscrux Jun 2, 2026
9353eec
feat: update gams qubo solver to new version
Elscrux Jun 15, 2026
80c27a4
feat: add new gurobi-based lp parser
Elscrux Jun 15, 2026
2f85eed
refactor: use gurobi lp parser for gams qubo
Elscrux Jun 15, 2026
f4ff57b
refactor: use gurobi lp parser for dwave qubo
Elscrux Jun 15, 2026
4576a6f
feat(install-python-dependencies): add option to filter for the folde…
Elscrux Jun 15, 2026
beef57c
refactor: use gurobi lp parser for qiskit qubo + support for constants
Elscrux Jun 15, 2026
2822bd9
feat(process-runner): add option to add more than one input file
Elscrux Jun 17, 2026
deb9a8a
style: allow not to use braces for single line if statements (often u…
Elscrux Jun 17, 2026
6fa2a59
feat: add unsplittable mcf with two solvers, one classical, one via qubo
Elscrux Jun 17, 2026
2e35f19
feat: improve Gams Qubo solver description
Elscrux Jun 18, 2026
898d0af
test: remove D-Wave Solver from test because it doesn't reliably prod…
Elscrux Jun 19, 2026
a8aca20
Merge pull request #153 from ProvideQ/feat/gams-qubo
koalamitice Jun 22, 2026
040815f
Add basic structure for OpenQASM processing
ekulos-code Jan 29, 2025
f9a59e8
Add execution and optimization solvers
ekulos-code Mar 10, 2025
6785d03
Merge dev, account for checkstyle errors
ekulos-code Mar 10, 2025
d918fb6
Implement suggestions
ekulos-code Mar 19, 2025
3c9275e
Add execution and optimization solvers
ekulos-code Mar 10, 2025
1be0aa9
Implement suggestions
ekulos-code Mar 19, 2025
c44c7c2
Preliminary migration for circuit processing to venvs
ekulos-code May 26, 2025
d5f5df4
Fix issues caused by changes on develop
ekulos-code Apr 22, 2026
9bb1323
Add basic testing for circuit processing
ekulos-code Apr 29, 2026
aad9cc2
Add problem fetching from files for tests and configs
ekulos-code May 7, 2026
daaf816
Implement first range of suggestions
ekulos-code Jun 5, 2026
431f503
Implement second range of suggestions
ekulos-code Jun 15, 2026
d2d9235
Fix checkstyle errors
ekulos-code Jun 25, 2026
b1a82a2
Merge pull request #133 from ProvideQ/circuit-processing
Elscrux Jun 25, 2026
fc53a5e
feat(qubo): deprecate kipu and quantagonia qubo solver
Elscrux Jun 26, 2026
589aa58
test(qubo): remove kipu and quantagonia qubo
Elscrux Jun 26, 2026
c7aa6b2
ci: automatic deployment
Elscrux Jun 26, 2026
9f265b8
ci: remove ssh password
Elscrux Jun 26, 2026
82e8eb9
ci: run script instead of trying to run a script file
Elscrux Jun 26, 2026
c97072e
chore: remove unused imports
Elscrux Jun 26, 2026
1d7f925
docs: document deprecation
Elscrux Jun 26, 2026
2da8dcf
test: increase attempted solve time for all solver tests
Elscrux Jun 26, 2026
f30627a
ci: debug
Elscrux Jun 26, 2026
c804b9e
Merge pull request #155 from ProvideQ/feat/deprecate-kipu-quantagonia
Elscrux Jun 26, 2026
918cd23
ci: set command timeout to 60 minutes
Elscrux Jun 26, 2026
e171a86
ci: always clone the latest state first
Elscrux Jun 26, 2026
c8ad912
ci: rename to simply ci-cd because it's also run for the master
Elscrux Jul 14, 2026
59d3fe3
docs: update badge
Elscrux Jul 14, 2026
bcf822b
chore: updated version number
koalamitice Jul 15, 2026
116ad96
Merge pull request #161 from ProvideQ/release/0.5.0
koalamitice Jul 15, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
shell: bash # required for the source command
run: | # change to "./gradlew check --info" for more debugging output.
source /opt/conda/bin/activate gams
./gradlew check
./gradlew check --info

- name: Archive test reports
if: always()
Expand All @@ -65,16 +65,20 @@ jobs:
deploy-staging:
runs-on: ubuntu-latest
needs: check
if: ${{ github.ref == 'refs/heads/develop' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
steps:
- name: Clone repo (shallow)
- name: Cloning repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master

- name: Deploy via SSH and Docker Compose
uses: appleboy/ssh-action@v1.2.5
with:
branch: develop
# only extracting the server address to a secret avoids leaking it in the logs
git_remote_url: ssh://dokku@${{ secrets.DOKKU_SERVER_ADDRESS }}/toolbox-backend-staging
ssh_private_key: ${{ secrets.DOKKU_DEPLOYMENT_KEY }}
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 60m
script: |
echo "Deploying ${{ github.event.repository.name }} to '${{ github.ref_name }}' environment"
sh /root/ProvideQ/${{ github.event.repository.name }}/deploy.sh ${{ github.ref_name }}
24 changes: 0 additions & 24 deletions .github/workflows/deploy-main.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ __pycache__/
# Software license key for GAMS, used for a docker container with GAMS included
gamslice.txt

# Listing files compiled from our GAMS scripts
# Don't include GAMS Data eXchange (GDX)
*.gdx

# Listing files compiled from our GAMS scripts files, which are generated when running GAMS solvers
*.lst
*.op2
solvers/gams/**/225a
Expand Down
8 changes: 8 additions & 0 deletions CITATION.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@inproceedings{eichhorn2025provideq,
title={Provideq: A quantum optimization toolbox},
author={Eichhorn, Domenik and Poser, Nick and Schweikart, Maximilian and Schaefer, Ina},
booktitle={2025 IEEE International Conference on Quantum Software (QSW)},
pages={206--214},
year={2025},
organization={IEEE}
}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ RUN jlink \
FROM debian:bookworm-slim AS runner
WORKDIR /app

# Install system build tools, needed to build solver dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
g++ \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

COPY scripts scripts

# Install GAMS with conda python environment
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build](https://img.shields.io/github/actions/workflow/status/ProvideQ/toolbox-server/deploy-main.yml?style=for-the-badge)](https://github.com/ProvideQ/toolbox-server/actions/workflows/deploy-main.yml)
[![Build](https://img.shields.io/github/actions/workflow/status/ProvideQ/toolbox-server/ci-cd.yml?branch=main&style=for-the-badge
)](https://github.com/ProvideQ/toolbox-server/actions/workflows/ci-cd.yml)
[![Release](https://img.shields.io/github/v/release/ProvideQ/toolbox-server?style=for-the-badge)](https://github.com/ProvideQ/toolbox-server/releases/)

# ProvideQ Toolbox Server
Expand Down Expand Up @@ -86,6 +87,6 @@ To use this, enable GitHub Actions and configure the following secrets in the Gi
3. Set `DOKKU_DEPLOYMENT_KEY` to the private key generated in step i.

## License
Copyright (c) 2022 - 2023 ProvideQ
Copyright (c) 2022 - 2026 ProvideQ

This project is available under the [MIT License](./LICENSE).
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ plugins {
}

group = 'edu.kit.provideq'
version = '0.4.1'
sourceCompatibility = '17'
version = '0.5.0'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url = 'https://jitpack.io' }
}

dependencies {
Expand All @@ -35,9 +39,6 @@ tasks.named('test') {
useJUnitPlatform()
}

// set Java language level
targetCompatibility = JavaVersion.VERSION_17

tasks.withType(JavaCompile).configureEach {
// treat "unchecked" warnings as errors
options.compilerArgs << '-Xlint:unchecked'
Expand Down
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</module>
<module name="NeedBraces">
<property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE"/>
</module>
<module name="LeftCurly">
<property name="tokens"
Expand Down
113 changes: 113 additions & 0 deletions demonstrators/qiskit/molecule-energy/molecule-energy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
from qiskit import QuantumCircuit
from qiskit_algorithms import VQE
from qiskit_algorithms.optimizers import L_BFGS_B, SLSQP
from qiskit.circuit.library import TwoLocal
from qiskit_nature.second_q.algorithms import GroundStateEigensolver
from qiskit_nature.second_q.circuit.library import HartreeFock, UCCSD
from qiskit_nature.second_q.drivers import PySCFDriver
from qiskit_nature.second_q.mappers import JordanWignerMapper, ParityMapper
from qiskit.primitives import Estimator
import matplotlib.pyplot as plt
from io import StringIO
import numpy as np
import sys

arg_count = len(sys.argv) - 1
if arg_count != 1:
raise ValueError(f'This script expects exactly 1 argument: the molecule, but got {arg_count}: {sys.argv[1:]}')
molecule = sys.argv[1]

driver = PySCFDriver(atom=molecule)
problem = driver.run()

mapper = ParityMapper(num_particles=problem.num_particles)

optimizer = L_BFGS_B()

estimator = Estimator()

ansatz = UCCSD(
problem.num_spatial_orbitals,
problem.num_particles,
mapper,
initial_state=HartreeFock(
problem.num_spatial_orbitals,
problem.num_particles,
mapper,
),
)

vqe = VQE(estimator, ansatz, optimizer)
vqe.initial_point = [0] * ansatz.num_parameters

algorithm = GroundStateEigensolver(mapper, vqe)

electronic_structure_result = algorithm.solve(problem)
electronic_structure_result.formatting_precision = 6

driver = PySCFDriver(atom='H .0 .0 .0; H .0 .0 0.74279')
problem = driver.run()

mapper = JordanWignerMapper()

optimizer = SLSQP(maxiter=10000, ftol=1e-9)

estimator = Estimator()

var_forms = [['ry', 'rz'], 'ry']
entanglements = ['full', 'linear']
entanglement_blocks = ['cx', 'cz', ['cx', 'cz']]
depths = list(range(1, 11))

reference_circuit = QuantumCircuit(4)
reference_circuit.x(0)
reference_circuit.x(2)

results = np.zeros((len(depths), len(entanglements), len(var_forms), len(entanglement_blocks)))

for i, d in enumerate(depths):
for j, e in enumerate(entanglements):
for k, vf in enumerate(var_forms):
for l, eb in enumerate(entanglement_blocks):
variational_form = TwoLocal(4, rotation_blocks=vf, entanglement_blocks=eb, entanglement=e, reps=d)

ansatz = reference_circuit.compose(variational_form)

vqe = VQE(estimator, ansatz, optimizer)
vqe.initial_point = [0] * ansatz.num_parameters

algorithm = GroundStateEigensolver(mapper, vqe)

electronic_structure_result = algorithm.solve(problem)

results[i, j, k, l] = electronic_structure_result.total_energies[0]

fig1, axs1 = plt.subplots(2, 3, sharey=True, sharex=True)
fig2, axs2 = plt.subplots(2, 3, sharey=True, sharex=True)

fig1.supxlabel('Depth')
fig1.supylabel('Estimated ground state energy')
fig2.supxlabel('Depth')
fig2.supylabel('Estimated ground state energy')

for j, e in enumerate(entanglements):
for l, eb in enumerate(entanglement_blocks):
axs1[j, l].plot(depths, results[:, j, 0, l])
axs1[j, l].set_title(f'{e}, ryrz, {eb}')
axs1[j, l].text(0.90, 0.75, f'Min: {np.min(results[:, j, 0, l]):.3f}')

for j, e in enumerate(entanglements):
for l, eb in enumerate(entanglement_blocks):
axs2[j, l].plot(depths, results[:, j, 1, l])
axs2[j, l].set_title(f'{e}, ry, {eb}')
axs2[j, l].text(0.90, 0.75, f'Min: {np.min(results[:, j, 1, l]):.3f}')


def print_fig(fig):
string_io = StringIO()
fig.savefig(string_io, format='svg')
print(string_io.getvalue())


print_fig(fig1)
print_fig(fig2)
14 changes: 14 additions & 0 deletions demonstrators/qiskit/molecule-energy/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file describes the python package requirements for all Qiskit demonstrator scripts
# supported by ProvideQ

# required for molecule energy solver
qiskit==1.1.0
qiskit-aer==0.14.2
qiskit-algorithms==0.3.0
qiskit-ibm-runtime==0.25.0
qiskit-machine-learning==0.7.2
qiskit-nature==0.7.2
qiskit-nature-pyscf==0.4.0
qiskit-qasm3-import==0.5.0
qiskit-transpiler-service==0.4.5
matplotlib==3.9.2
11 changes: 10 additions & 1 deletion scripts/install-python-dependencies.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import os
import subprocess
import platform
import sys

script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.dirname(script_dir)

# Check if a specific folder argument was provided
folder_filter = sys.argv[1] if len(sys.argv) > 1 else None

base_dirs = [
os.path.join(root_dir, 'demonstrators'),
os.path.join(root_dir, 'solvers'),
Expand All @@ -19,13 +24,17 @@
# Iterate over problem directory (knapsack, tsp, etc.)
for solver_name in os.listdir(framework_dir):
solver_dir = os.path.join(framework_dir, solver_name)
# If folder filter is specified, only process matching folders
if folder_filter and folder_filter not in solver_dir:
continue

req_file = os.path.join(solver_dir, 'requirements.txt')
if os.path.exists(req_file):
venv_name = f"{os.path.basename(root)}_{framework_name}_{solver_name}"
print(f"Setting up virtual environment '{venv_name}' for {solver_dir}...")
try:
venv_path = os.path.join('venv', venv_name)
subprocess.run(['python3', '-m', 'venv', venv_path], check=True)
subprocess.run(['python', '-m', 'venv', venv_path], check=True)
if platform.system() == 'Windows':
pip_executable = os.path.join(venv_path, 'Scripts', 'pip.exe')
else:
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-gams.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apt-get install curl --yes
# iisaa/gams-docker (https://github.com/iiasa/gams-docker/blob/master/Dockerfile, GPL-3.0 licensed)

# Configure the GAMS version here
GAMS_VERSION_RELEASE_MAJOR=49.3
GAMS_VERSION_RELEASE_MAJOR=52.5
GAMS_VERSION_HOTFIX=0

# download the self-extracting archive to /opt/gams/gams.exe and run/extract it
Expand Down
34 changes: 34 additions & 0 deletions solvers/_utility/parse_qubo_from_lp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
def parse_qubo_from_lp(model) -> tuple[list[str], dict[tuple[int, int], float], dict[int, float], float]:
vars = [x.VarName for x in model.getVars() if x.VType == "B"]

obj = model.getObjective()

quadratic_terms = {
(vars.index(term[1].VarName), vars.index(term[2].VarName)): term[0]
for term in obj.quadTerms()
}

linear_terms = {
vars.index(var.VarName): coeff
for coeff, var in obj.linTerms()
if var.VType == "B"
}

# Detect constant terms from non-binary variables
# A variable is considered a constant if:
# 1. Its LB equals its UB (fixed variable), OR
# 2. Its name can be parsed as an integer
constant_offset = obj.getLinExpr().getConstant()

# Extract constant contributions
constant_contributions = [
coeff * lb if lb == ub else (
coeff * int(var.VarName) if var.VarName.isdigit() else 0
)
for coeff, var in obj.getLinExpr().linTerms()
for lb, ub in [(var.getAttr('LB'), var.getAttr('UB'))]
]

constant_offset += sum(constant_contributions)

return vars, quadratic_terms, linear_terms, constant_offset
Loading
Loading