engioptiqa 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- engioptiqa-0.2.2/.github/workflows/doc.yml +21 -0
- engioptiqa-0.2.2/.github/workflows/test_examples.yml +34 -0
- engioptiqa-0.2.2/.gitignore +17 -0
- engioptiqa-0.2.2/LICENSE +21 -0
- engioptiqa-0.2.2/PKG-INFO +60 -0
- engioptiqa-0.2.2/README.md +38 -0
- engioptiqa-0.2.2/docs/Makefile +20 -0
- engioptiqa-0.2.2/docs/annealing_solvers.rst +60 -0
- engioptiqa-0.2.2/docs/conf.py +32 -0
- engioptiqa-0.2.2/docs/index.rst +68 -0
- engioptiqa-0.2.2/docs/make.bat +35 -0
- engioptiqa-0.2.2/docs/problems.rst +11 -0
- engioptiqa-0.2.2/docs/rod_1d_problems.rst +75 -0
- engioptiqa-0.2.2/docs/variables.rst +32 -0
- engioptiqa-0.2.2/engioptiqa/__init__.py +9 -0
- engioptiqa-0.2.2/engioptiqa/annealing_solvers/__init__.py +7 -0
- engioptiqa-0.2.2/engioptiqa/annealing_solvers/annealing_solver.py +21 -0
- engioptiqa-0.2.2/engioptiqa/annealing_solvers/annealing_solver_amplify.py +55 -0
- engioptiqa-0.2.2/engioptiqa/annealing_solvers/annealing_solver_dwave.py +93 -0
- engioptiqa-0.2.2/engioptiqa/problems/__init__.py +7 -0
- engioptiqa-0.2.2/engioptiqa/problems/rod_1d/__init__.py +9 -0
- engioptiqa-0.2.2/engioptiqa/problems/rod_1d/base_problem.py +806 -0
- engioptiqa-0.2.2/engioptiqa/problems/rod_1d/design_optimization_problem.py +151 -0
- engioptiqa-0.2.2/engioptiqa/problems/rod_1d/rod_1d.py +56 -0
- engioptiqa-0.2.2/engioptiqa/problems/rod_1d/structural_analysis_problem.py +38 -0
- engioptiqa-0.2.2/engioptiqa/problems/solution_emulator.py +24 -0
- engioptiqa-0.2.2/engioptiqa/variables/__init__.py +3 -0
- engioptiqa-0.2.2/engioptiqa/variables/real_number.py +96 -0
- engioptiqa-0.2.2/engioptiqa.egg-info/PKG-INFO +60 -0
- engioptiqa-0.2.2/engioptiqa.egg-info/SOURCES.txt +36 -0
- engioptiqa-0.2.2/engioptiqa.egg-info/dependency_links.txt +1 -0
- engioptiqa-0.2.2/engioptiqa.egg-info/requires.txt +9 -0
- engioptiqa-0.2.2/engioptiqa.egg-info/top_level.txt +1 -0
- engioptiqa-0.2.2/examples/rod_1d/design_optimization_sa.py +87 -0
- engioptiqa-0.2.2/examples/rod_1d/structural_analysis_sa.py +85 -0
- engioptiqa-0.2.2/pyproject.toml +33 -0
- engioptiqa-0.2.2/requirements.txt +9 -0
- engioptiqa-0.2.2/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: doc
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
generate_doc:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v3
|
|
10
|
+
- name: build doc
|
|
11
|
+
run: |
|
|
12
|
+
pip install sphinx
|
|
13
|
+
sphinx-build -W -b html docs/ docs/build -j auto
|
|
14
|
+
|
|
15
|
+
- name: deploy doc
|
|
16
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
17
|
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
18
|
+
with:
|
|
19
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
publish_dir: ./docs/build
|
|
21
|
+
force_orphan: true
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Test Examples
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: [ "*" ]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [ "*" ]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
run_examples:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.11"
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install -r requirements.txt
|
|
27
|
+
|
|
28
|
+
- name: Run all examples
|
|
29
|
+
run: |
|
|
30
|
+
set -e
|
|
31
|
+
for f in $(find examples -name "*.py"); do
|
|
32
|
+
echo "Running $f"
|
|
33
|
+
python "$f"
|
|
34
|
+
done
|
engioptiqa-0.2.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 EngiOptiQA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: engioptiqa
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Engineering Optimization with Quantum Annealing
|
|
5
|
+
Author-email: Fabian Key <fabian.key@tuwien.ac.at>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/EngiOptiQA/EngiOptiQA
|
|
8
|
+
Project-URL: Documentation, https://engioptiqa.github.io/EngiOptiQA/
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: amplify[extra]==1.4.0
|
|
13
|
+
Requires-Dist: dwave-cloud-client==0.14.0
|
|
14
|
+
Requires-Dist: dwave-samplers==1.6.0
|
|
15
|
+
Requires-Dist: dwave-system==1.33.0
|
|
16
|
+
Requires-Dist: matplot2tikz==0.4.2
|
|
17
|
+
Requires-Dist: matplotlib==3.10.7
|
|
18
|
+
Requires-Dist: numpy==2.2.6
|
|
19
|
+
Requires-Dist: prettytable==3.16.0
|
|
20
|
+
Requires-Dist: sympy==1.14.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
[](https://doi.org/10.5281/zenodo.10222617)
|
|
24
|
+
[](https://github.com/EngiOptiQA/EngiOptiQA/actions/workflows/test_examples.yml)
|
|
25
|
+
|
|
26
|
+
# EngiOptiQA: Engineering Optimization with Quantum Annealing
|
|
27
|
+
|
|
28
|
+
**Please note:** _EngiOptiQA_ is currently in a very early stage of development. As the project progresses, documentation, additional features, and enhancements will be added.
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
_EngiOptiQA_ is a Python software library dedicated to **Engi**neering **Opti**mization with **Q**uantum **A**nnealing (QA).
|
|
32
|
+
This project provides a set of tools to formulate engineering optimization problems suitable for QA.
|
|
33
|
+
|
|
34
|
+
A minimal documentation can be found under [https://engioptiqa.github.io/EngiOptiQA/](https://engioptiqa.github.io/EngiOptiQA/). To learn more about the background of _EngiOptiQA_ and the implemented problem formulations, please refer to the corresponding publication [[1]](#pub1).
|
|
35
|
+
|
|
36
|
+
## Citation
|
|
37
|
+
|
|
38
|
+
If you use _EngiOptiQA_ in your research or work, please consider citing it using the software's [DOI](https://zenodo.org/doi/10.5281/zenodo.10222617) and the corresponding publication [Key2024](#pub1).
|
|
39
|
+
|
|
40
|
+
## Quick Example
|
|
41
|
+
|
|
42
|
+
Run this example for the design optimization of a rod under self-weight loading presented in [Key2024](#pub1), Section 3.2, solved using *simulated annealing (SA)*:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install -r requirements.txt
|
|
46
|
+
python3 examples/rod_1d/design_optimization_sa.py
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The expected $H_1$ error for the best solution is approximately $1.59 \times 10^{-2}$:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
H1 Error 0.015873015873015817 0.015873015873015817
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
58
|
+
|
|
59
|
+
## References
|
|
60
|
+
1. <a name="pub1"></a>Key F, Freinberger L. A Formulation of Structural Design Optimization Problems for Quantum Annealing. Mathematics. 2024; 12(3):482. [https://doi.org/10.3390/math12030482](https://doi.org/10.3390/math12030482)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[](https://doi.org/10.5281/zenodo.10222617)
|
|
2
|
+
[](https://github.com/EngiOptiQA/EngiOptiQA/actions/workflows/test_examples.yml)
|
|
3
|
+
|
|
4
|
+
# EngiOptiQA: Engineering Optimization with Quantum Annealing
|
|
5
|
+
|
|
6
|
+
**Please note:** _EngiOptiQA_ is currently in a very early stage of development. As the project progresses, documentation, additional features, and enhancements will be added.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
_EngiOptiQA_ is a Python software library dedicated to **Engi**neering **Opti**mization with **Q**uantum **A**nnealing (QA).
|
|
10
|
+
This project provides a set of tools to formulate engineering optimization problems suitable for QA.
|
|
11
|
+
|
|
12
|
+
A minimal documentation can be found under [https://engioptiqa.github.io/EngiOptiQA/](https://engioptiqa.github.io/EngiOptiQA/). To learn more about the background of _EngiOptiQA_ and the implemented problem formulations, please refer to the corresponding publication [[1]](#pub1).
|
|
13
|
+
|
|
14
|
+
## Citation
|
|
15
|
+
|
|
16
|
+
If you use _EngiOptiQA_ in your research or work, please consider citing it using the software's [DOI](https://zenodo.org/doi/10.5281/zenodo.10222617) and the corresponding publication [Key2024](#pub1).
|
|
17
|
+
|
|
18
|
+
## Quick Example
|
|
19
|
+
|
|
20
|
+
Run this example for the design optimization of a rod under self-weight loading presented in [Key2024](#pub1), Section 3.2, solved using *simulated annealing (SA)*:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install -r requirements.txt
|
|
24
|
+
python3 examples/rod_1d/design_optimization_sa.py
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The expected $H_1$ error for the best solution is approximately $1.59 \times 10^{-2}$:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
H1 Error 0.015873015873015817 0.015873015873015817
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
36
|
+
|
|
37
|
+
## References
|
|
38
|
+
1. <a name="pub1"></a>Key F, Freinberger L. A Formulation of Structural Design Optimization Problems for Quantum Annealing. Mathematics. 2024; 12(3):482. [https://doi.org/10.3390/math12030482](https://doi.org/10.3390/math12030482)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.. Annealing Solvers Overview
|
|
2
|
+
|
|
3
|
+
============================
|
|
4
|
+
Annealing Solvers
|
|
5
|
+
============================
|
|
6
|
+
|
|
7
|
+
.. Annealing Solver
|
|
8
|
+
.. ================
|
|
9
|
+
|
|
10
|
+
.. .. automodule:: engioptiqa.annealing_solvers
|
|
11
|
+
|
|
12
|
+
.. Annealing Solver Class
|
|
13
|
+
.. ----------------------
|
|
14
|
+
|
|
15
|
+
.. .. currentmodule:: engioptiqa.annealing_solvers.annealing_solver
|
|
16
|
+
|
|
17
|
+
.. .. autoclass:: AnnealingSolver
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
.. Annealing Solver Methods
|
|
21
|
+
.. ------------------------
|
|
22
|
+
|
|
23
|
+
.. .. autosummary::
|
|
24
|
+
.. :toctree: generated/
|
|
25
|
+
|
|
26
|
+
Annealing Solver Amplify
|
|
27
|
+
========================
|
|
28
|
+
|
|
29
|
+
.. automodule:: engioptiqa.annealing_solvers.annealing_solver_amplify
|
|
30
|
+
|
|
31
|
+
Annealing Solver Amplify Class
|
|
32
|
+
------------------------------
|
|
33
|
+
|
|
34
|
+
.. currentmodule:: engioptiqa.annealing_solvers.annealing_solver_amplify
|
|
35
|
+
|
|
36
|
+
.. autoclass:: AnnealingSolverAmplify
|
|
37
|
+
|
|
38
|
+
Annealing Solver Amplify Methods
|
|
39
|
+
--------------------------------
|
|
40
|
+
|
|
41
|
+
.. autosummary::
|
|
42
|
+
:toctree: generated/
|
|
43
|
+
|
|
44
|
+
Annealing Solver DWave
|
|
45
|
+
========================
|
|
46
|
+
|
|
47
|
+
.. automodule:: engioptiqa.annealing_solvers.annealing_solver_dwave
|
|
48
|
+
|
|
49
|
+
Annealing Solver DWave Class
|
|
50
|
+
------------------------------
|
|
51
|
+
|
|
52
|
+
.. currentmodule:: engioptiqa.annealing_solvers.annealing_solver_dwave
|
|
53
|
+
|
|
54
|
+
.. autoclass:: AnnealingSolverDWave
|
|
55
|
+
|
|
56
|
+
Annealing Solver DWave Methods
|
|
57
|
+
--------------------------------
|
|
58
|
+
|
|
59
|
+
.. autosummary::
|
|
60
|
+
:toctree: generated/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
project = 'EngiOptiQA'
|
|
10
|
+
copyright = '2024, Fabian Key'
|
|
11
|
+
author = 'Fabian Key'
|
|
12
|
+
|
|
13
|
+
# -- General configuration ---------------------------------------------------
|
|
14
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
15
|
+
|
|
16
|
+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary']
|
|
17
|
+
|
|
18
|
+
templates_path = ['_templates']
|
|
19
|
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
20
|
+
|
|
21
|
+
# Path to the root of your project, relative to the documentation source directory.
|
|
22
|
+
import os
|
|
23
|
+
import sys
|
|
24
|
+
sys.path.insert(0, os.path.abspath('..'))
|
|
25
|
+
autodoc_mock_imports = ['amplify', 'dimod', 'dwave', 'matplotlib', 'numpy', 'prettytable', 'scipy', 'sympy','matplot2tikz']
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# -- Options for HTML output -------------------------------------------------
|
|
29
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
30
|
+
|
|
31
|
+
html_theme = 'alabaster'
|
|
32
|
+
#html_static_path = ['_static']
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.. EngiOptiQA documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Thu Feb 15 10:49:44 2024.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
Welcome to EngiOptiQA's documentation!
|
|
7
|
+
======================================
|
|
8
|
+
|
|
9
|
+
*EngiOptiQA* is a software project that allows to perform **Engi**\neering **Opti**\mization with **Q**\uantum **A**\nnealing.
|
|
10
|
+
|
|
11
|
+
Overview
|
|
12
|
+
========
|
|
13
|
+
|
|
14
|
+
*EngiOptiQA* consists of three main modules:
|
|
15
|
+
|
|
16
|
+
1. :ref:`Annealing Solvers Module<solvers-module>`
|
|
17
|
+
2. :ref:`Problems Module<problems-module>`
|
|
18
|
+
3. :ref:`Variables Module<variables-module>`
|
|
19
|
+
|
|
20
|
+
.. _solvers-module:
|
|
21
|
+
|
|
22
|
+
Annealing Solvers Module
|
|
23
|
+
========================
|
|
24
|
+
|
|
25
|
+
This module contains solvers for *Quadratic Unconstrained Binary Optimization (QUBO)* problems.
|
|
26
|
+
There are two alternative implementations based on the `Fixstars Amplify SDK <https://amplify.fixstars.com/en/sdk>`_ or the `DWave Ocean SDK <https://www.dwavesys.com/solutions-and-products/ocean/>`_, respectively.
|
|
27
|
+
|
|
28
|
+
.. toctree::
|
|
29
|
+
:maxdepth: 2
|
|
30
|
+
|
|
31
|
+
annealing_solvers
|
|
32
|
+
|
|
33
|
+
.. _problems-module:
|
|
34
|
+
|
|
35
|
+
Problems Module
|
|
36
|
+
===============
|
|
37
|
+
|
|
38
|
+
This modules provides classes for setting up *QUBO* problems.
|
|
39
|
+
So far, this includes the one-dimensional problem of a rod.
|
|
40
|
+
|
|
41
|
+
.. toctree::
|
|
42
|
+
:maxdepth: 2
|
|
43
|
+
|
|
44
|
+
problems
|
|
45
|
+
|
|
46
|
+
.. _variables-module:
|
|
47
|
+
|
|
48
|
+
Variables Module
|
|
49
|
+
================
|
|
50
|
+
|
|
51
|
+
This module includes classes for the representation of variables in logical qubits.
|
|
52
|
+
At the moment, there exist different options for representing real-valued variables.
|
|
53
|
+
|
|
54
|
+
.. toctree::
|
|
55
|
+
:maxdepth: 2
|
|
56
|
+
|
|
57
|
+
variables
|
|
58
|
+
|
|
59
|
+
Indices and tables
|
|
60
|
+
==================
|
|
61
|
+
|
|
62
|
+
* :ref:`genindex`
|
|
63
|
+
* :ref:`modindex`
|
|
64
|
+
* :ref:`search`
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=.
|
|
11
|
+
set BUILDDIR=_build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.. Rod (1D) Problems
|
|
2
|
+
|
|
3
|
+
============================
|
|
4
|
+
Rod (1D) Problems
|
|
5
|
+
============================
|
|
6
|
+
|
|
7
|
+
For the one-dimensional description of a rod under self-weight loading, there exist two problem formulations:
|
|
8
|
+
|
|
9
|
+
1. :ref:`Structural Analysis Problem <structural-analysis-problem>`
|
|
10
|
+
2. :ref:`Design Optimization Problem <design-optimization-problem>`
|
|
11
|
+
|
|
12
|
+
.. Base Problem
|
|
13
|
+
.. ============
|
|
14
|
+
|
|
15
|
+
.. .. automodule:: engioptiqa.problems.rod_1d.base_problem
|
|
16
|
+
|
|
17
|
+
.. Base Problem Class
|
|
18
|
+
.. ------------------
|
|
19
|
+
|
|
20
|
+
.. .. currentmodule:: engioptiqa.problems.rod_1d.base_problem
|
|
21
|
+
|
|
22
|
+
.. .. autoclass:: BaseProblem
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.. Base Problem Methods
|
|
26
|
+
.. --------------------
|
|
27
|
+
|
|
28
|
+
.. .. autosummary::
|
|
29
|
+
.. :toctree: generated/
|
|
30
|
+
|
|
31
|
+
.. ~BaseProblem.set_output_path
|
|
32
|
+
|
|
33
|
+
.. _structural-analysis-problem:
|
|
34
|
+
|
|
35
|
+
Structural Analysis Problem
|
|
36
|
+
===========================
|
|
37
|
+
|
|
38
|
+
.. automodule:: engioptiqa.problems.rod_1d.structural_analysis_problem
|
|
39
|
+
|
|
40
|
+
Structural Analysis Problem Class
|
|
41
|
+
---------------------------------
|
|
42
|
+
|
|
43
|
+
.. currentmodule:: engioptiqa.problems.rod_1d.structural_analysis_problem
|
|
44
|
+
|
|
45
|
+
.. autoclass:: StructuralAnalysisProblem
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Structural Analysis Problem Methods
|
|
49
|
+
-----------------------------------
|
|
50
|
+
|
|
51
|
+
.. autosummary::
|
|
52
|
+
:toctree: generated/
|
|
53
|
+
|
|
54
|
+
.. _design-optimization-problem:
|
|
55
|
+
|
|
56
|
+
Design Optimization Problem
|
|
57
|
+
===========================
|
|
58
|
+
|
|
59
|
+
.. automodule:: engioptiqa.problems.rod_1d.design_optimization_problem
|
|
60
|
+
|
|
61
|
+
Design Optimization Problem Class
|
|
62
|
+
---------------------------------
|
|
63
|
+
|
|
64
|
+
.. currentmodule:: engioptiqa.problems.rod_1d.design_optimization_problem
|
|
65
|
+
|
|
66
|
+
.. autoclass:: DesignOptimizationProblem
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Design Optimization Problem Methods
|
|
70
|
+
-----------------------------------
|
|
71
|
+
|
|
72
|
+
.. autosummary::
|
|
73
|
+
:toctree: generated/
|
|
74
|
+
|
|
75
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.. Variables Overview
|
|
2
|
+
|
|
3
|
+
============================
|
|
4
|
+
Variables
|
|
5
|
+
============================
|
|
6
|
+
|
|
7
|
+
Real Number
|
|
8
|
+
============
|
|
9
|
+
|
|
10
|
+
.. automodule:: engioptiqa.variables
|
|
11
|
+
|
|
12
|
+
Real Number Class
|
|
13
|
+
------------------
|
|
14
|
+
|
|
15
|
+
.. currentmodule:: engioptiqa.variables.real_number
|
|
16
|
+
|
|
17
|
+
.. autoclass:: RealNumber
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
.. Real Number Attributes
|
|
21
|
+
.. -----------------------
|
|
22
|
+
|
|
23
|
+
.. .. autosummary::
|
|
24
|
+
.. :toctree: generated/
|
|
25
|
+
|
|
26
|
+
.. ~RealNumber.adj
|
|
27
|
+
|
|
28
|
+
Real Number Methods
|
|
29
|
+
--------------------
|
|
30
|
+
|
|
31
|
+
.. autosummary::
|
|
32
|
+
:toctree: generated/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
class AnnealingSolver(ABC):
|
|
4
|
+
|
|
5
|
+
def __init__(self, token_file=None, proxy=None):
|
|
6
|
+
self.proxy = proxy
|
|
7
|
+
if token_file is not None:
|
|
8
|
+
self.token = open(token_file,"r").read().replace('\n', '')
|
|
9
|
+
self.setup_client()
|
|
10
|
+
|
|
11
|
+
@abstractmethod
|
|
12
|
+
def setup_client(self):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def setup_solver(self):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def solve_qubo_problem(self, problem):
|
|
21
|
+
pass
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from amplify import Solver
|
|
2
|
+
from amplify.client import FixstarsClient
|
|
3
|
+
from amplify.client.ocean import DWaveSamplerClient, LeapHybridSamplerClient
|
|
4
|
+
|
|
5
|
+
from .annealing_solver import AnnealingSolver
|
|
6
|
+
|
|
7
|
+
class AnnealingSolverAmplify(AnnealingSolver):
|
|
8
|
+
"""
|
|
9
|
+
Initialize the Annealing Solver that uses the Amplify SDK.
|
|
10
|
+
|
|
11
|
+
:param client_type: The client type.
|
|
12
|
+
:param token_file: The path of the file that includes the token for the Fixstars Amplify Annealing Engine.
|
|
13
|
+
"""
|
|
14
|
+
def __init__(self, client_type, token_file, proxy=None):
|
|
15
|
+
self.client_type = client_type
|
|
16
|
+
super().__init__(token_file, proxy)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def setup_client(self):
|
|
20
|
+
|
|
21
|
+
if self.client_type == 'fixstars':
|
|
22
|
+
self.client = FixstarsClient(token=self.token)
|
|
23
|
+
elif self.client_type == 'dwave':
|
|
24
|
+
self.client = DWaveSamplerClient(token=self.token)
|
|
25
|
+
elif self.client_type == 'dwave_hybrid':
|
|
26
|
+
self.client = LeapHybridSamplerClient(token=self.token)
|
|
27
|
+
else:
|
|
28
|
+
raise Exception('Unknown client type', self.client_type)
|
|
29
|
+
if self.proxy:
|
|
30
|
+
self.client.proxy = self.proxy
|
|
31
|
+
if self.client_type in ['dwave','dwave_hybrid']:
|
|
32
|
+
print('Available solvers:', self.client.solver_names)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def setup_solver(self):
|
|
36
|
+
|
|
37
|
+
if self.client_type == 'fixstars':
|
|
38
|
+
print('Setting default timeout (ms): 800')
|
|
39
|
+
self.client.parameters.timeout = 800
|
|
40
|
+
elif self.client_type == 'dwave':
|
|
41
|
+
print('Choosing default solver: Advantage_system4.1')
|
|
42
|
+
self.client.solver = "Advantage_system4.1"
|
|
43
|
+
print('Setting default num_reads: 200')
|
|
44
|
+
self.client.parameters.num_reads = 200
|
|
45
|
+
elif self.client_type == 'dwave_hybrid':
|
|
46
|
+
print('Choosing default solver: hybrid_binary_quadratic_model_version2')
|
|
47
|
+
self.client.solver = 'hybrid_binary_quadratic_model_version2'
|
|
48
|
+
|
|
49
|
+
self.solver = Solver(self.client)
|
|
50
|
+
print("Created solver")
|
|
51
|
+
|
|
52
|
+
def solve_qubo_problem(self, problem):
|
|
53
|
+
|
|
54
|
+
problem.results = self.solver.solve(problem.binary_quadratic_model)
|
|
55
|
+
print('Number of solutions:', len(problem.results))
|