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

Added New Annealing Solver Type for Discrete Optimization Problems: sa_disc_type #8

Merged
merged 6 commits into from
Apr 7, 2023

Conversation

NolantheNerd
Copy link
Contributor

The existing OpenFSAM is very powerful and can solve many different kinds of optimization problems, but one class of problems seems to have been left out: discrete optimization problems! (Finding the ground state of the Ising model, the Quadratic Unconstrained Binary Optimization problem, MAX-2-SAT, etc.) To address this, I've written a new annealing type called sa_disc_type to be used for such problems.

The sa_disc_type extends sa_type_base and adds a few important object properties:

  • var_values: An array that allows the end user to specify the domain for their discrete objective function
  • num_perturb: Borrowed from the sa_cont_type, it specifies the number of parameters to perturb when seeking a new neighbouring state. Defaults to only changing one parameter at a time.

The new function get_neigh_disc finds a new neighbouring state by perturbing num_perturb parameters of the energy function. (It is flexible enough to allow for any number of possible domain values, not just functions with binary parameters.)

To complement this additional type, I've added an example that initializes and optimizes the Ising model.

The README has also been updated to accommodate the new type.

Side Note

Note that the sa_comb_type can technically be used to solve these discrete optimization problems, but the implementation is rather ugly. It requires setting an initial state which contains as many values as there are distinct values in the domain. (In the case of a problem with n binary parameters, this means 2n values.) Then, in the energy function, only the first n values must be used when calculating the performance of the given state. This technique comes with the additional downside that only one parameter can be perturbed in each iteration.

Nolan added 6 commits April 3, 2023 13:34
Designed to supplement the existing combinatorial annealer and
continuous function annealers. The discrete function annealer optimizes
a function which takes discrete parameters. Example problems include the
QUBO problem, MAX-2-SAT, and the problem associated with finding the
ground state of the Ising Model.
The neighbouring state did not start by matching the current state,
which left unacceptable values in the discovered neighbouring state.
@nfherrin
Copy link
Owner

nfherrin commented Apr 7, 2023

Nice! This is actually something I had setup to do in a problem I was working on using the sa_cont_type and binding ranges of reals to certain discrete values in the energy function. But this is much cleaner and easier to setup. Looks good! Thanks!

@nfherrin nfherrin merged commit dc94069 into nfherrin:master Apr 7, 2023
@NolantheNerd NolantheNerd deleted the discrete branch April 8, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants