Skip to content

Commit

Permalink
v1.2.0 (#28)
Browse files Browse the repository at this point in the history
* Recreated dev branch and incremented version

* Better C library for annealing QUSOs and PUSOs, remove Simulation. (#27)

* anneal c library, remove simulation objects

* update links in README

* update links in README

* pretty_str method

* added test for pretty str
  • Loading branch information
jtiosue authored Jun 17, 2020
1 parent 8149cfa commit 7f2fae6
Show file tree
Hide file tree
Showing 60 changed files with 3,091 additions and 3,517 deletions.
31 changes: 2 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The one-stop package for formulating, simulating, and solving problems in boolea
:target: https://qubovert.readthedocs.io/en/latest/
:alt: Documentation Status
.. image:: https://codecov.io/gh/jtiosue/qubovert/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jtiosue/qubovert
:target: https://codecov.io/gh/jtiosue/qubovert/branch/master
:alt: Code Coverage
.. image:: https://img.shields.io/lgtm/grade/python/g/jtiosue/qubovert.svg?logo=lgtm&logoWidth=18
:target: https://lgtm.com/projects/g/jtiosue/qubovert/context:python
Expand All @@ -28,7 +28,7 @@ The one-stop package for formulating, simulating, and solving problems in boolea
:target: https://qubovert.readthedocs.io/en/dev/
:alt: Documentation Status
.. image:: https://codecov.io/gh/jtiosue/qubovert/branch/dev/graph/badge.svg
:target: https://codecov.io/gh/jtiosue/qubovert
:target: https://codecov.io/gh/jtiosue/qubovert/branch/dev
:alt: Code Coverage

*pypi distribution*
Expand Down Expand Up @@ -327,33 +327,6 @@ Now we have to convert the solution in terms of the QUBO/QUSO variables back to
print(model.is_solution_valid(converted_quso_solution))
Simulating spin and boolean systems
-----------------------------------

We use a Metropolis algorithm to simulate spin and boolean system. Below we show an example for simulating a spin system (specifically, a 1D ferromagnetic chain). Similar functionality exists for QUBO, PUBO, and PUSO simulation with ``qubovert.sim.QUBOSimulation``, ``qubovert.sim.PUBOSimulation``, ``qubovert.sim.PUSOSimulation``. Please note that `QUSOSimulation`` and ``QUBOSimulation`` are much faster than ``PUSOSimulation`` and ``PUBOSimulation`` because the former are implemented in C. If you have a degree 2 or less model, use the QUBO and QUSO simulations!

.. code:: python
import qubovert as qv
length = 50
spin_system = sum(
-qv.spin_var(i) * qv.spin_var(i+1) for i in range(length)
)
# initial state is all spin down
initial_state = {i: -1 for i in range(length)}
sim = qv.sim.QUSOSimulation(spin_system, initial_state)
# define a schedule. here we simulate at temperature 4 for 25 time
# steps, then temperature 2 for 25 time steps, then temperature 1 for
# 10 time steps.
schedule = (4, 25), (2, 25), (1, 10)
sim.schedule_update(schedule)
print("final state", sim.state)
Convert common problems to quadratic form (the *problems* library)
------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/copyright.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright
=========

Joseph T. Iosue, joe.iosue@yahoo.com.
Joseph T. Iosue, jtiosue@gmail.com.

.. include:: ../LICENSE
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Indices and tables
:caption: Boolean/Spin Simulation

sim/anneal
sim/simulation
sim/anneal_results


.. toctree::
Expand Down
18 changes: 2 additions & 16 deletions docs/sim/anneal.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Annealing
=========

Note that the ``sim`` module will not be imported with ``from qubovert import *``. You must import ``qubovert.sim`` explicitly. Here we show some functions to use the boolean and spin simulation to run simulated annealing on the models.
These function interface with C source code to provide fast execution of the simulated annealing algorithm. Note that the ``sim`` module will not be imported with ``from qubovert import *``. You must import ``qubovert.sim`` explicitly. Here we show some functions to use the boolean and spin simulation to run simulated annealing on the models.

**Please note** that the ``qv.sim.anneal_qubo`` and ``qv.sim.anneal_quso`` functions perform much faster than the ``qv.sim.anneal_pubo`` and ``qv.sim.anneal_puso`` functions since the former are written in C and wrapped in Python. If your system has degree 2 or less, then you should use the QUBO or QUSO anneal functions!
**Please note** that the ``qv.sim.anneal_qubo`` and ``qv.sim.anneal_quso`` functions perform faster than the ``qv.sim.anneal_pubo`` and ``qv.sim.anneal_puso`` functions. If your system has degree 2 or less, then you should use the QUBO or QUSO anneal functions!



Expand Down Expand Up @@ -31,20 +31,6 @@ Anneal QUSO
.. autofunction:: qubovert.sim.anneal_quso


Anneal Results
--------------

These objects are defined to deal with the output of the annealing functions.


.. autoclass:: qubovert.sim.AnnealResults
:members:


.. autoclass:: qubovert.sim.AnnealResult
:members:


Anneal temperature range
------------------------

Expand Down
13 changes: 13 additions & 0 deletions docs/sim/anneal_results.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Anneal Results
==============

These objects are defined to deal with the output of the annealing functions.


.. autoclass:: qubovert.sim.AnnealResults
:members:
:inherited-members:


.. autoclass:: qubovert.sim.AnnealResult
:members:
38 changes: 0 additions & 38 deletions docs/sim/simulation.rst

This file was deleted.

Loading

0 comments on commit 7f2fae6

Please sign in to comment.