eqc-models 0.15.1__tar.gz → 0.15.3__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.
- {eqc_models-0.15.1 → eqc_models-0.15.3}/PKG-INFO +1 -1
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/algorithms/alm.py +199 -47
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/rcshortestpath.py +3 -1
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/shortestpath.py +4 -2
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models.egg-info/PKG-INFO +1 -1
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models.egg-info/SOURCES.txt +1 -0
- eqc_models-0.15.3/scripts/ALM_maxcut_demo.ipynb +483 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testalm.py +181 -5
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testshortestpath.py +8 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/.gitignore +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/.gitlab-ci.yml +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/LICENSE.txt +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/MANIFEST.in +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/README.md +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/compile_extensions.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/Makefile +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/basic.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/css/badge_only.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/css/theme.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/custom.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/file.png +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/minus.png +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/plus.png +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/pygments.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/build/html/_static/white_logo.png +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/make.bat +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/_static/custom.css +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/_static/white_logo.png +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/conf.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/dependencies.rst +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/eqc_models.rst +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/index.rst +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/modules.rst +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/docs/source/usage.rst +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/algorithms/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/algorithms/base.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/algorithms/penaltymultiplier.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/allocation/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/allocation/allocation.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/allocation/portbase.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/allocation/portmomentum.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/assignment/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/assignment/qap.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/assignment/resource.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/assignment/setpartition.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/base.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/binaries.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/constraints.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/operators.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/polyeval.pyx +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/polynomial.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/quadratic.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/base/results.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/combinatorics/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/combinatorics/setcover.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/combinatorics/setpartition.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/decoding.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/base.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/hypergraph.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/maxcut.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/maxkcut.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/graph/partition.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/classifierbase.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/classifierqboost.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/classifierqsvm.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/clusteringbase.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/cvqboost_hamiltonian.pyx +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/cvqboost_hamiltonian_c_func.c +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/cvqboost_hamiltonian_c_func.h +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/decomposition.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/forecast.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/forecastbase.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/regressor.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/regressorbase.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/reservoir.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/ml/utils.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/process/base.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/process/mpc.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/sequence/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/sequence/tsp.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/solvers/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/solvers/eqcdirect.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/solvers/mip.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/solvers/qciclient.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/solvers/responselog.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/utilities/__init__.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/utilities/fileio.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/utilities/general.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/utilities/polynomial.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models/utilities/qplib.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models.egg-info/dependency_links.txt +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models.egg-info/requires.txt +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/eqc_models.egg-info/top_level.txt +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/pyproject.toml +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/ALM_pipeline.ipynb +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/binary_job_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/binary_w_continuous_solver_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/c6h6_graph_clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/continuous_job_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/convert_to_json_problem.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/crew_assignment_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/graph_clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/graph_partitioning.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/hamiltonian_to_polynomial.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/hypergraph.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/integer_job_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/karate_graph_clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/lin_reg_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/mackey_glass_cell_production_series.csv +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/mip_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/pca_iris_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/port_opt_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qboost_iris_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qboost_iris_dirac3_weak_cls.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qplib_benchmark_config.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qplib_reader.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qplib_runner.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qsvm_dual_iris_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/qsvm_iris_dirac3.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/reservoir_forecast.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/results_example.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/rundoctests.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/test_reservoir.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/test_shortestpath.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/scripts/utils.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/setup.cfg +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/doctest_base.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testallocationmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testconstraint.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testcvqboost.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testeqcdirectsolver.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testgraphpartitionmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testhypergraphmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testmaxcutmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testpolynomialmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testqapmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testqciclientsolver.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testquadraticmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testsetcovermodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testsetpartitionmodel.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test/testtsp.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/README.txt +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/run_tests.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/c6h6_graph_clustering/c6h6_graph_clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/clustering/clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/clustering/data/X.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/cvqboost_iris/cvqboost_iris.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/cvqboost_iris/data/X_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/cvqboost_iris/data/X_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/cvqboost_iris/data/y_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/cvqboost_iris/data/y_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/karate_graph_clustering/karate_graph_clustering.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/pca_iris/pca_iris.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1MJC/data/C_1MJC.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1MJC/data/J_1MJC.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1MJC/protein_design_1MJC.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1NXB/data/C_1NXB.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1NXB/data/J_1NXB.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1NXB/protein_design_1NXB.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1POH/data/C_1POH.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1POH/data/J_1POH.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/protein_design_1POH/protein_design_1POH.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_dual_iris/data/X_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_dual_iris/data/X_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_dual_iris/data/y_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_dual_iris/data/y_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_dual_iris/qsvm_dual_iris.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_primal_iris/data/X_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_primal_iris/data/X_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_primal_iris/data/y_test.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_primal_iris/data/y_train.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/qsvm_primal_iris/qsvm_primal_iris.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_100/data/C_8000000_100.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_100/data/J_8000000_100.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_100/synthetic_cls_100.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_300/data/C_8000000_300.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_300/data/J_8000000_300.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_300/synthetic_cls_300.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_500/data/C_8000000_500.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_500/data/J_8000000_500.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_500/synthetic_cls_500.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_700/data/C_8000000_700.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_700/data/J_8000000_700.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_700/synthetic_cls_700.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_900/data/C_8000000_900.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_900/data/J_8000000_900.npy +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_cases/synthetic_cls_900/synthetic_cls_900.py +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_suite_config.json +0 -0
- {eqc_models-0.15.1 → eqc_models-0.15.3}/test_suite/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eqc-models
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.3
|
|
4
4
|
Summary: Optimization and ML modeling package targeting EQC devices
|
|
5
5
|
Author-email: "Quantum Computing Inc." <support@quantumcomputinginc.com>
|
|
6
6
|
Project-URL: Homepage, https://quantumcomputinginc.com
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# (C) Quantum Computing Inc., 2025.
|
|
2
|
-
from dataclasses import dataclass
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
3
|
from typing import Callable, Dict, List, Tuple, Optional, Sequence, Union
|
|
4
4
|
import numpy as np
|
|
5
5
|
from collections import defaultdict
|
|
@@ -16,6 +16,7 @@ class ALMConstraint:
|
|
|
16
16
|
fun: Callable[[Array], Array] # h(x) or g(x)
|
|
17
17
|
jac: Optional[Callable[[Array], Array]] = None
|
|
18
18
|
name: str = ""
|
|
19
|
+
family: str = ""
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
@dataclass
|
|
@@ -34,6 +35,11 @@ class ALMConfig:
|
|
|
34
35
|
rho_g: float = 50.0 # inequalities / one-hot
|
|
35
36
|
rho_min: float = 1e-3
|
|
36
37
|
rho_max: float = 1e3
|
|
38
|
+
# per-family penalty overrides
|
|
39
|
+
rho_eq_family: Dict[str, float] = field(default_factory=dict)
|
|
40
|
+
rho_ineq_family: Dict[str, float] = field(default_factory=dict)
|
|
41
|
+
# allow per-family adaptation toggle (optional)
|
|
42
|
+
adapt_by_family: bool = True
|
|
37
43
|
# adaptation toggles
|
|
38
44
|
adapt: bool = True
|
|
39
45
|
tau_up_h: float = 0.90
|
|
@@ -68,11 +74,11 @@ class ConstraintRegistry:
|
|
|
68
74
|
self.constraints: List[ALMConstraint] = []
|
|
69
75
|
self.blocks: List[ALMBlock] = []
|
|
70
76
|
|
|
71
|
-
def add_equality(self, fun, jac=None, name=""):
|
|
72
|
-
self.constraints.append(ALMConstraint("eq", fun, jac, name))
|
|
77
|
+
def add_equality(self, fun, jac=None, name="", family=""):
|
|
78
|
+
self.constraints.append(ALMConstraint("eq", fun, jac, name, family))
|
|
73
79
|
|
|
74
|
-
def add_inequality(self, fun, jac=None, name=""):
|
|
75
|
-
self.constraints.append(ALMConstraint("ineq", fun, jac, name))
|
|
80
|
+
def add_inequality(self, fun, jac=None, name="", family=""):
|
|
81
|
+
self.constraints.append(ALMConstraint("ineq", fun, jac, name, family))
|
|
76
82
|
|
|
77
83
|
def add_block(self, idx: Sequence[int], levels: Array, sum_to_one=True, one_hot=True):
|
|
78
84
|
self.blocks.append(ALMBlock(list(idx), np.asarray(levels, float), sum_to_one, one_hot))
|
|
@@ -306,7 +312,7 @@ class ALMAlgorithm:
|
|
|
306
312
|
n = 0
|
|
307
313
|
for inds in getattr(model, "indices", getattr(model.polynomial, "indices", [])):
|
|
308
314
|
for j in inds:
|
|
309
|
-
if
|
|
315
|
+
if j > 0:
|
|
310
316
|
n = max(n, j)
|
|
311
317
|
lifted_slices: List[List[int]] = []
|
|
312
318
|
|
|
@@ -315,6 +321,18 @@ class ALMAlgorithm:
|
|
|
315
321
|
target_lifted_n = sum(len(blk.levels) for blk in blocks)
|
|
316
322
|
base_n = getattr(base_model, "n", None)
|
|
317
323
|
|
|
324
|
+
def _infer_n_from_terms(pm: PolynomialModel) -> int:
|
|
325
|
+
inds_list = getattr(pm, "indices", getattr(pm.polynomial, "indices", []))
|
|
326
|
+
mx = 0
|
|
327
|
+
for inds in inds_list:
|
|
328
|
+
for j in inds:
|
|
329
|
+
if j > mx:
|
|
330
|
+
mx = j
|
|
331
|
+
return int(mx)
|
|
332
|
+
|
|
333
|
+
if base_n is None:
|
|
334
|
+
base_n = _infer_n_from_terms(base_model)
|
|
335
|
+
|
|
318
336
|
# detect "already-lifted" native input (compat path)
|
|
319
337
|
already_lifted = (base_n == target_lifted_n)
|
|
320
338
|
|
|
@@ -377,6 +395,7 @@ class ALMAlgorithm:
|
|
|
377
395
|
fun=ALMAlgorithm._make_sum1_fun(S),
|
|
378
396
|
jac=ALMAlgorithm._make_sum1_jac(S),
|
|
379
397
|
name=f"sum_to_one_block_{lift_idx[0]}",
|
|
398
|
+
family="block_sum1",
|
|
380
399
|
))
|
|
381
400
|
if blk.enforce_one_hot:
|
|
382
401
|
k = len(lift_idx)
|
|
@@ -386,6 +405,7 @@ class ALMAlgorithm:
|
|
|
386
405
|
fun=ALMAlgorithm._make_onehot_fun(lift_idx, M),
|
|
387
406
|
jac=ALMAlgorithm._make_onehot_jac(lift_idx, M, n),
|
|
388
407
|
name=f"onehot_block_{lift_idx[0]}",
|
|
408
|
+
family="block_onehot",
|
|
389
409
|
))
|
|
390
410
|
return eqs
|
|
391
411
|
|
|
@@ -406,16 +426,34 @@ class ALMAlgorithm:
|
|
|
406
426
|
r0 = csp.fun(x).reshape(-1)
|
|
407
427
|
mu_ineq.append(np.zeros_like(r0, dtype=float))
|
|
408
428
|
|
|
429
|
+
rho_eq_family = dict(getattr(cfg, "rho_eq_family", {}) or {})
|
|
430
|
+
rho_ineq_family = dict(getattr(cfg, "rho_ineq_family", {}) or {})
|
|
431
|
+
|
|
432
|
+
def _rho_for(csp_k: ALMConstraint) -> float:
|
|
433
|
+
fam = getattr(csp_k, "family", "") or ""
|
|
434
|
+
if csp_k.kind == "eq":
|
|
435
|
+
return float(rho_eq_family.get(fam, rho_h))
|
|
436
|
+
else:
|
|
437
|
+
return float(rho_ineq_family.get(fam, rho_g))
|
|
438
|
+
|
|
409
439
|
# -------- running stats for adaptive penalties --------
|
|
410
440
|
rho_h, rho_g = cfg.rho_h, cfg.rho_g
|
|
411
441
|
best_eq, best_ineq = np.inf, np.inf
|
|
412
442
|
no_imp_eq = no_imp_ineq = 0
|
|
413
443
|
prev_eq_inf, prev_ineq_inf = np.inf, np.inf
|
|
414
444
|
eps = 1e-12
|
|
445
|
+
prev_eq_inf_by_family, prev_ineq_inf_by_family = {}, {}
|
|
446
|
+
# ---- per-family stagnation tracking (only used when cfg.adapt_by_family=True)
|
|
447
|
+
best_eq_by_family: Dict[str, float] = {}
|
|
448
|
+
best_ineq_by_family: Dict[str, float] = {}
|
|
449
|
+
no_imp_eq_by_family: Dict[str, int] = {}
|
|
450
|
+
no_imp_ineq_by_family: Dict[str, int] = {}
|
|
415
451
|
|
|
416
452
|
hist = {"eq_inf": [], "ineq_inf": [], "obj": [], "x": [],
|
|
417
453
|
# per-iteration logs for parameters/multipliers
|
|
418
454
|
"rho_h": [], "rho_g": [],
|
|
455
|
+
"rho_eq_family": [], "rho_ineq_family": [],
|
|
456
|
+
"eq_inf_by_family": [], "ineq_inf_by_family": [],
|
|
419
457
|
}
|
|
420
458
|
for k_idx, csp in enumerate(full_eqs):
|
|
421
459
|
if csp.kind != "eq":
|
|
@@ -447,8 +485,9 @@ class ALMAlgorithm:
|
|
|
447
485
|
assert A.shape[1] == n, f"A has {A.shape[1]} cols, expected {n}"
|
|
448
486
|
# linearization about current x: residual model r(x) = A x - b, with b = A x - h
|
|
449
487
|
b = A @ x - h
|
|
450
|
-
|
|
451
|
-
|
|
488
|
+
rho_k = _rho_for(csp)
|
|
489
|
+
Qk = 0.5 * rho_k * (A.T @ A)
|
|
490
|
+
ck = (A.T @ lam_eq[k_idx]) - rho_k * (A.T @ b)
|
|
452
491
|
Q_aug += Qk
|
|
453
492
|
c_aug += ck
|
|
454
493
|
have_aug = True
|
|
@@ -462,18 +501,19 @@ class ALMAlgorithm:
|
|
|
462
501
|
G = np.atleast_2d(G)
|
|
463
502
|
assert G.shape[1] == n, f"G has {G.shape[1]} cols, expected {n}"
|
|
464
503
|
d = G @ x - g
|
|
504
|
+
rho_k = _rho_for(csp)
|
|
465
505
|
# Activation measure at current iterate; meaning, the current violating inequality components:
|
|
466
506
|
# g(x) + mu/rho; Powell-Hestenes-Rockafellar shifted residual
|
|
467
|
-
y = G @ x - d + mu_ineq[k_idx] /
|
|
507
|
+
y = G @ x - d + mu_ineq[k_idx] / rho_k
|
|
468
508
|
active = (y > cfg.act_tol)
|
|
469
509
|
if np.any(active):
|
|
470
510
|
GA = G[active, :]
|
|
471
511
|
muA = mu_ineq[k_idx][active]
|
|
472
512
|
gA = g[active]
|
|
473
513
|
# Q += (rho/2) * GA^T GA
|
|
474
|
-
Qk = 0.5 *
|
|
514
|
+
Qk = 0.5 * rho_k * (GA.T @ GA)
|
|
475
515
|
# c += GA^T mu - rho * GA^T (GA x - gA); where GA x - gA is active measures of d = G @ x - g
|
|
476
|
-
ck = (GA.T @ muA) -
|
|
516
|
+
ck = (GA.T @ muA) - rho_k * (GA.T @ (GA @ x - gA))
|
|
477
517
|
Q_aug += Qk
|
|
478
518
|
c_aug += ck
|
|
479
519
|
have_aug = True
|
|
@@ -514,12 +554,23 @@ class ALMAlgorithm:
|
|
|
514
554
|
x = getattr(out, "x", out)
|
|
515
555
|
x = np.asarray(x, float)
|
|
516
556
|
|
|
557
|
+
# ---- multiplier tracking ----
|
|
558
|
+
for k_idx, csp in enumerate(full_eqs):
|
|
559
|
+
if csp.kind != "eq": continue
|
|
560
|
+
hist[f"lam_eq_max_idx{k_idx}"].append(float(np.max(lam_eq[k_idx])))
|
|
561
|
+
hist[f"lam_eq_min_idx{k_idx}"].append(float(np.min(lam_eq[k_idx])))
|
|
562
|
+
for k_idx, csp in enumerate(problem_ineqs):
|
|
563
|
+
if csp.kind != "ineq": continue
|
|
564
|
+
hist[f"mu_ineq_max_idx{k_idx}"].append(float(np.max(mu_ineq[k_idx])))
|
|
565
|
+
hist[f"mu_ineq_min_idx{k_idx}"].append(float(np.min(mu_ineq[k_idx])))
|
|
566
|
+
|
|
517
567
|
# -------- residuals + multiplier updates --------
|
|
518
568
|
eq_infs = []
|
|
519
569
|
for k_idx, csp in enumerate(full_eqs):
|
|
520
570
|
if csp.kind != "eq": continue
|
|
521
571
|
r = csp.fun(x).reshape(-1)
|
|
522
|
-
|
|
572
|
+
rho_k = _rho_for(csp)
|
|
573
|
+
lam_eq[k_idx] = lam_eq[k_idx] + rho_k * r
|
|
523
574
|
if r.size:
|
|
524
575
|
eq_infs.append(np.max(np.abs(r)))
|
|
525
576
|
eq_inf = float(np.max(eq_infs)) if eq_infs else 0.0
|
|
@@ -528,7 +579,8 @@ class ALMAlgorithm:
|
|
|
528
579
|
for k_idx, csp in enumerate(problem_ineqs):
|
|
529
580
|
if csp.kind != "ineq": continue
|
|
530
581
|
r = csp.fun(x).reshape(-1)
|
|
531
|
-
|
|
582
|
+
rho_k = _rho_for(csp)
|
|
583
|
+
mu_ineq[k_idx] = np.maximum(0.0, mu_ineq[k_idx] + rho_k * r)
|
|
532
584
|
if r.size:
|
|
533
585
|
ineq_infs.append(np.max(np.maximum(0.0, r)))
|
|
534
586
|
ineq_inf = float(np.max(ineq_infs)) if ineq_infs else 0.0
|
|
@@ -536,25 +588,55 @@ class ALMAlgorithm:
|
|
|
536
588
|
assert len(lam_eq) == len(full_eqs)
|
|
537
589
|
assert len(mu_ineq) == len(problem_ineqs)
|
|
538
590
|
|
|
591
|
+
# ---- per-family residual telemetry ----
|
|
592
|
+
eq_inf_by_family = {}
|
|
593
|
+
for k_idx, csp in enumerate(full_eqs):
|
|
594
|
+
if csp.kind != "eq": continue
|
|
595
|
+
fam = getattr(csp, "family", "") or ""
|
|
596
|
+
r = csp.fun(x).reshape(-1)
|
|
597
|
+
v = float(np.max(np.abs(r))) if r.size else 0.0
|
|
598
|
+
eq_inf_by_family[fam] = max(eq_inf_by_family.get(fam, 0.0), v)
|
|
599
|
+
|
|
600
|
+
ineq_inf_by_family = {}
|
|
601
|
+
for k_idx, csp in enumerate(problem_ineqs):
|
|
602
|
+
if csp.kind != "ineq": continue
|
|
603
|
+
fam = getattr(csp, "family", "") or ""
|
|
604
|
+
r = csp.fun(x).reshape(-1)
|
|
605
|
+
v = float(np.max(np.maximum(0.0, r))) if r.size else 0.0
|
|
606
|
+
ineq_inf_by_family[fam] = max(ineq_inf_by_family.get(fam, 0.0), v)
|
|
607
|
+
|
|
539
608
|
# evaluate base polynomial only (ca add aug value if want to track full L_A)
|
|
540
609
|
f_val = ALMAlgorithm._poly_value(base_terms, x)
|
|
541
610
|
|
|
542
611
|
hist["eq_inf"].append(eq_inf); hist["ineq_inf"].append(ineq_inf)
|
|
543
612
|
hist["obj"].append(float(f_val)); hist["x"].append(x.copy())
|
|
544
|
-
# parameter
|
|
613
|
+
# parameter tracking
|
|
545
614
|
hist["rho_h"].append(float(rho_h)); hist["rho_g"].append(float(rho_g))
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
for k_idx, csp in enumerate(problem_ineqs):
|
|
551
|
-
if csp.kind != "ineq": continue
|
|
552
|
-
hist[f"mu_ineq_max_idx{k_idx}"].append(float(np.max(mu_ineq[k_idx])))
|
|
553
|
-
hist[f"mu_ineq_min_idx{k_idx}"].append(float(np.min(mu_ineq[k_idx])))
|
|
615
|
+
hist["rho_eq_family"].append(dict(rho_eq_family))
|
|
616
|
+
hist["rho_ineq_family"].append(dict(rho_ineq_family))
|
|
617
|
+
hist["eq_inf_by_family"].append(dict(eq_inf_by_family))
|
|
618
|
+
hist["ineq_inf_by_family"].append(dict(ineq_inf_by_family))
|
|
554
619
|
|
|
555
620
|
if verbose:
|
|
621
|
+
# show worst 3 equality families by residual, with their rhos
|
|
622
|
+
eq_items = sorted(eq_inf_by_family.items(), key=lambda kv: kv[1], reverse=True)
|
|
623
|
+
eq_top = eq_items[:3]
|
|
624
|
+
eq_str = ",".join([
|
|
625
|
+
f"{fam or 'eq'}:{val:.2e}@"
|
|
626
|
+
f"{_rho_for(next(c for c in full_eqs if (getattr(c,'family','') or '')==fam and c.kind=='eq')):.1g}"
|
|
627
|
+
for fam, val in eq_top
|
|
628
|
+
])
|
|
629
|
+
# show worst 3 inequality families by residual, with their rhos
|
|
630
|
+
ineq_items = sorted(ineq_inf_by_family.items(), key=lambda kv: kv[1], reverse=True)
|
|
631
|
+
ineq_top = ineq_items[:3]
|
|
632
|
+
ineq_str = ",".join([
|
|
633
|
+
f"{fam or 'ineq'}:{val:.2e}@"
|
|
634
|
+
f"{_rho_for(next(c for c in problem_ineqs if (getattr(c, 'family', '') or '') == fam and c.kind == 'ineq')):.1g}"
|
|
635
|
+
for fam, val in ineq_top
|
|
636
|
+
])
|
|
637
|
+
|
|
556
638
|
print(f"[ALM {it:02d}] f={f_val:.6g} | eq_inf={eq_inf:.2e} | ineq_inf={ineq_inf:.2e} "
|
|
557
|
-
f"| rho_h={rho_h:.2e} | rho_g={rho_g:.2e}")
|
|
639
|
+
f"| rho_h={rho_h:.2e} | rho_g={rho_g:.2e} | eq_fam[{eq_str}] | ineq_fam[{ineq_str}]")
|
|
558
640
|
|
|
559
641
|
# stopping
|
|
560
642
|
if eq_inf <= cfg.tol_h and ineq_inf <= cfg.tol_g:
|
|
@@ -572,35 +654,105 @@ class ALMAlgorithm:
|
|
|
572
654
|
|
|
573
655
|
# -------- Residual-ratio controller --------
|
|
574
656
|
if cfg.adapt and it > 0:
|
|
575
|
-
#
|
|
576
|
-
if
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
657
|
+
# per-family rho adaptation for equalities
|
|
658
|
+
if getattr(cfg, "adapt_by_family", False):
|
|
659
|
+
# Equality family
|
|
660
|
+
for fam, cur in eq_inf_by_family.items():
|
|
661
|
+
prev = max(prev_eq_inf_by_family.get(fam, cur), eps)
|
|
662
|
+
# rho value for family: if absent, start at rho_h
|
|
663
|
+
rho_f = float(rho_eq_family.get(fam, rho_h))
|
|
664
|
+
if cur > cfg.tau_up_h * prev:
|
|
665
|
+
rho_f = min(cfg.gamma_up * rho_f, cfg.rho_max)
|
|
666
|
+
elif cur < cfg.tau_down_h * prev:
|
|
667
|
+
rho_f = max(cfg.gamma_down * rho_f, cfg.rho_min)
|
|
668
|
+
rho_eq_family[fam] = rho_f
|
|
669
|
+
# update prev map
|
|
670
|
+
prev_eq_inf_by_family = dict(eq_inf_by_family)
|
|
671
|
+
|
|
672
|
+
# Inequality family
|
|
673
|
+
for fam, cur in ineq_inf_by_family.items():
|
|
674
|
+
prev = max(prev_ineq_inf_by_family.get(fam, cur), eps)
|
|
675
|
+
# rho value for family: if absent, start at rho_g
|
|
676
|
+
rho_f = float(rho_ineq_family.get(fam, rho_g))
|
|
677
|
+
if cur > cfg.tau_up_g * prev:
|
|
678
|
+
rho_f = min(cfg.gamma_up * rho_f, cfg.rho_max)
|
|
679
|
+
elif cur < cfg.tau_down_g * prev:
|
|
680
|
+
rho_f = max(cfg.gamma_down * rho_f, cfg.rho_min)
|
|
681
|
+
rho_ineq_family[fam] = rho_f
|
|
682
|
+
# update prev map
|
|
683
|
+
prev_ineq_inf_by_family = dict(ineq_inf_by_family)
|
|
684
|
+
else:
|
|
685
|
+
# Equality group
|
|
686
|
+
if eq_inf_smooth > cfg.tau_up_h * max(prev_eq_inf, eps): # stalled or not shrinking
|
|
687
|
+
rho_h = min(cfg.gamma_up * rho_h, cfg.rho_max)
|
|
688
|
+
elif eq_inf_smooth < cfg.tau_down_h * max(prev_eq_inf, eps): # fast progress, allow relaxation
|
|
689
|
+
rho_h = max(cfg.gamma_down * rho_h, cfg.rho_min)
|
|
690
|
+
|
|
691
|
+
# Inequality group
|
|
692
|
+
if ineq_inf_smooth > cfg.tau_up_g * max(prev_ineq_inf, eps):
|
|
693
|
+
rho_g = min(cfg.gamma_up * rho_g, cfg.rho_max)
|
|
694
|
+
elif ineq_inf_smooth < cfg.tau_down_g * max(prev_ineq_inf, eps):
|
|
695
|
+
rho_g = max(cfg.gamma_down * rho_g, cfg.rho_min)
|
|
696
|
+
else:
|
|
697
|
+
# per-family rho adaptation for equalities
|
|
698
|
+
if getattr(cfg, "adapt_by_family", False):
|
|
699
|
+
# update prev map
|
|
700
|
+
prev_eq_inf_by_family = dict(eq_inf_by_family)
|
|
701
|
+
prev_ineq_inf_by_family = dict(ineq_inf_by_family)
|
|
586
702
|
|
|
587
703
|
# -------- Stagnation bump (safety net) --------
|
|
588
704
|
if cfg.use_stagnation_bump:
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
705
|
+
if getattr(cfg, "adapt_by_family", False):
|
|
706
|
+
# ---- Equality families ----
|
|
707
|
+
for fam, cur in eq_inf_by_family.items():
|
|
708
|
+
# initialize
|
|
709
|
+
if fam not in best_eq_by_family:
|
|
710
|
+
best_eq_by_family[fam] = float(cur)
|
|
711
|
+
no_imp_eq_by_family[fam] = 0
|
|
712
|
+
|
|
713
|
+
if cur <= best_eq_by_family[fam] * (1 - cfg.stagnation_factor):
|
|
714
|
+
best_eq_by_family[fam] = float(cur)
|
|
715
|
+
no_imp_eq_by_family[fam] = 0
|
|
716
|
+
else:
|
|
717
|
+
no_imp_eq_by_family[fam] += 1
|
|
718
|
+
if no_imp_eq_by_family[fam] >= cfg.patience_h:
|
|
719
|
+
rho_f = float(rho_eq_family.get(fam, rho_h))
|
|
720
|
+
rho_eq_family[fam] = min(2.0 * rho_f, cfg.rho_max)
|
|
721
|
+
no_imp_eq_by_family[fam] = 0
|
|
722
|
+
|
|
723
|
+
# ---- Inequality families ----
|
|
724
|
+
for fam, cur in ineq_inf_by_family.items():
|
|
725
|
+
# initialize
|
|
726
|
+
if fam not in best_ineq_by_family:
|
|
727
|
+
best_ineq_by_family[fam] = float(cur)
|
|
728
|
+
no_imp_ineq_by_family[fam] = 0
|
|
729
|
+
|
|
730
|
+
if cur <= best_ineq_by_family[fam] * (1 - cfg.stagnation_factor):
|
|
731
|
+
best_ineq_by_family[fam] = float(cur)
|
|
732
|
+
no_imp_ineq_by_family[fam] = 0
|
|
733
|
+
else:
|
|
734
|
+
no_imp_ineq_by_family[fam] += 1
|
|
735
|
+
if no_imp_ineq_by_family[fam] >= cfg.patience_g:
|
|
736
|
+
rho_f = float(rho_ineq_family.get(fam, rho_g))
|
|
737
|
+
rho_ineq_family[fam] = min(2.0 * rho_f, cfg.rho_max)
|
|
738
|
+
no_imp_ineq_by_family[fam] = 0
|
|
596
739
|
|
|
597
|
-
# Inequality stagnation
|
|
598
|
-
if ineq_inf <= best_ineq * (1 - cfg.stagnation_factor):
|
|
599
|
-
best_ineq = ineq_inf; no_imp_ineq = 0
|
|
600
740
|
else:
|
|
601
|
-
|
|
602
|
-
if
|
|
603
|
-
|
|
741
|
+
# Equality stagnation
|
|
742
|
+
if eq_inf <= best_eq * (1 - cfg.stagnation_factor):
|
|
743
|
+
best_eq = eq_inf; no_imp_eq = 0
|
|
744
|
+
else:
|
|
745
|
+
no_imp_eq += 1
|
|
746
|
+
if no_imp_eq >= cfg.patience_h:
|
|
747
|
+
rho_h = min(2.0 * rho_h, cfg.rho_max); no_imp_eq = 0
|
|
748
|
+
|
|
749
|
+
# Inequality stagnation
|
|
750
|
+
if ineq_inf <= best_ineq * (1 - cfg.stagnation_factor):
|
|
751
|
+
best_ineq = ineq_inf; no_imp_ineq = 0
|
|
752
|
+
else:
|
|
753
|
+
no_imp_ineq += 1
|
|
754
|
+
if no_imp_ineq >= cfg.patience_g:
|
|
755
|
+
rho_g = min(2.0 * rho_g, cfg.rho_max); no_imp_ineq = 0
|
|
604
756
|
|
|
605
757
|
# -------- finalize for next iteration --------
|
|
606
758
|
prev_eq_inf = max(eq_inf_smooth, eps)
|
|
@@ -68,8 +68,9 @@ class RCShortestPathModel(ShortestPathModel):
|
|
|
68
68
|
path_len = 0
|
|
69
69
|
path_cost = 0
|
|
70
70
|
path_resources = 0
|
|
71
|
-
while node != t:
|
|
71
|
+
while node != self.t:
|
|
72
72
|
edge = (node, path[node])
|
|
73
|
+
log.debug("Processing edge %s for pathCost", edge)
|
|
73
74
|
if edge not in G.edges:
|
|
74
75
|
raise ValueError(f"Edge {edge} not found")
|
|
75
76
|
path_len += 1
|
|
@@ -77,5 +78,6 @@ class RCShortestPathModel(ShortestPathModel):
|
|
|
77
78
|
path_resources += G.edges[edge][self.resource_key]
|
|
78
79
|
if path_len > max_len:
|
|
79
80
|
raise ValueError("Invalid path. Describes a cycle.")
|
|
81
|
+
node = edge[1]
|
|
80
82
|
return path_cost, path_resources
|
|
81
83
|
|
|
@@ -200,13 +200,15 @@ class ShortestPathModel(EdgeMixin, ConstrainedQuadraticModel):
|
|
|
200
200
|
max_len = len(self.G.nodes) - 1
|
|
201
201
|
path_len = 0
|
|
202
202
|
path_cost = 0
|
|
203
|
-
while node != t:
|
|
203
|
+
while node != self.t:
|
|
204
204
|
edge = (node, path[node])
|
|
205
|
+
log.debug("Processing edge %s for pathCost", edge)
|
|
205
206
|
if edge not in G.edges:
|
|
206
207
|
raise ValueError(f"Edge {edge} not found")
|
|
207
208
|
path_len += 1
|
|
208
209
|
path_cost += G.edges[edge]["weight"]
|
|
209
210
|
if path_len > max_len:
|
|
210
|
-
raise ValueError("Invalid path. Describes a cycle.")
|
|
211
|
+
raise ValueError(f"Invalid path. Describes a cycle.")
|
|
212
|
+
node = edge[1]
|
|
211
213
|
return path_cost
|
|
212
214
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eqc-models
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.3
|
|
4
4
|
Summary: Optimization and ML modeling package targeting EQC devices
|
|
5
5
|
Author-email: "Quantum Computing Inc." <support@quantumcomputinginc.com>
|
|
6
6
|
Project-URL: Homepage, https://quantumcomputinginc.com
|
|
@@ -93,6 +93,7 @@ eqc_models/utilities/fileio.py
|
|
|
93
93
|
eqc_models/utilities/general.py
|
|
94
94
|
eqc_models/utilities/polynomial.py
|
|
95
95
|
eqc_models/utilities/qplib.py
|
|
96
|
+
scripts/ALM_maxcut_demo.ipynb
|
|
96
97
|
scripts/ALM_pipeline.ipynb
|
|
97
98
|
scripts/binary_job_example.py
|
|
98
99
|
scripts/binary_w_continuous_solver_example.py
|