Skip to content

Commit

Permalink
Merge pull request #183 from arcondello/fix/flatten-Model-States-math…
Browse files Browse the repository at this point in the history
…ematical-docs

Flatten the docs for Model, State, and mathematical functions
  • Loading branch information
arcondello authored Dec 11, 2024
2 parents 628da93 + a8ecdd9 commit 07e2ef1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 88 deletions.
18 changes: 1 addition & 17 deletions docs/reference/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,4 @@ Mathematical Functions
.. currentmodule:: dwave.optimization

.. automodule:: dwave.optimization.mathematical

.. autosummary::
:toctree: generated/

~add
~concatenate
~divide
~logical
~logical_and
~logical_or
~logical_not
~logical_xor
~maximum
~minimum
~mod
~multiply
~where
:members:
75 changes: 6 additions & 69 deletions docs/reference/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,79 +18,16 @@ Model Class
-----------

.. autoclass:: Model

Model Attributes
----------------

.. autosummary::
:toctree: generated/

~Model.objective
~Model.states

Model Primitives
----------------

Instantiation of the model's decision (and constant) symbols.
For the full list of supported symbols, see the :ref:`optimization_symbols`
page.

.. autosummary::
:toctree: generated/

~Model.binary
~Model.constant
~Model.disjoint_bit_sets
~Model.disjoint_lists
~Model.integer
~Model.list
~Model.set

Model Methods
-------------

.. autosummary::
:toctree: generated/

~Model.add_constraint
~Model.decision_state_size
~Model.from_file
~Model.into_file
~Model.is_locked
~Model.iter_constraints
~Model.iter_decisions
~Model.iter_symbols
~Model.lock
~Model.minimize
~Model.num_constraints
~Model.num_decisions
~Model.num_nodes
~Model.num_symbols
~Model.quadratic_model
~Model.remove_unused_symbols
~Model.state_size
~Model.to_file
~Model.to_networkx
~Model.unlock
:members:
:inherited-members:
:member-order: bysource

States Class
------------

.. currentmodule:: dwave.optimization.states

.. autoclass:: States

States Methods
--------------

.. autosummary::
:toctree: generated/

~States.clear
~States.from_file
~States.from_future
~States.into_file
~States.resize
~States.resolve
~States.size
~States.to_file
:members:
:inherited-members:
:member-order: bysource
2 changes: 1 addition & 1 deletion dwave/optimization/mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def sqrt(x: ArraySymbol) -> SquareRoot:
>>> model.states.resize(1)
>>> with model.lock():
... print(sqrt_x.state())
4
4.0
See Also:
:class:`~dwave.optimization.symbols.SquareRoot`: equivalent symbol.
"""
Expand Down
2 changes: 1 addition & 1 deletion dwave/optimization/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def feasible(self, index: int = 0) -> bool:
>>> model = Model()
>>> b = model.binary()
>>> model.add_constraint(b) # doctest: +ELLIPSIS
<dwave.optimization.BinaryVariable at ...>
<dwave.optimization.symbols.BinaryVariable at ...>
>>> model.states.resize(2)
>>> b.set_state(0, 1) # Feasible
>>> b.set_state(1, 0) # Infeasible
Expand Down

0 comments on commit 07e2ef1

Please sign in to comment.