Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hungarian algorithm for the linear assignment problem. #1083

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions docs/api/assignment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Assignment problem
==================

.. currentmodule:: optax.assignment

.. autosummary::
hungarian_algorithm


Hungarian algorithm
~~~~~~~~~~~~~~~~~~~
.. autofunction:: hungarian_algorithm
21 changes: 21 additions & 0 deletions docs/gallery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,27 @@
</div>


.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="Solving the linear assignment problem.">

.. only:: html

.. image:: /images/examples/linear_assignment_problem.png
:alt:

:doc:`_collections/examples/linear_assignment_problem`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Solving the linear assignment problem.</div>
</div>

.. raw:: html

</div>


Contrib Examples
----------------

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ for instructions on installing JAX.
:caption: 📖 Reference
:maxdepth: 2

api/assignment
api/optimizers
api/transformations
api/combining_optimizers
Expand Down
329 changes: 329 additions & 0 deletions examples/linear_assignment_problem.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions optax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# pylint: disable=wrong-import-position
# pylint: disable=g-importing-member

from optax import assignment
from optax import contrib
from optax import losses
from optax import monte_carlo
Expand Down Expand Up @@ -306,6 +307,7 @@
"apply_updates",
"ApplyEvery",
"ApplyIfFiniteState",
"assignment",
"centralize",
"chain",
"clip_by_block_rms",
Expand Down
19 changes: 19 additions & 0 deletions optax/assignment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""The assignment sub-package."""

# pylint:disable=g-importing-member

from optax.assignment._hungarian_algorithm import hungarian_algorithm
Loading
Loading