Function hercules::python_interopt::pso

source ·
pub fn pso(
    problem: (Vec<usize>, Vec<usize>, Vec<f64>, Vec<f64>, usize),
    seed: usize,
    num_particles: usize,
    max_steps: usize
) -> PyResult<(Vec<usize>, f64)>
Expand description

This reads in the QUBO from a file, and solves the QUBO using particle swarm optimization, returns the best solution found.

Example

import hercules

# read in the QUBO from a file
problem = hercules.read_qubo("file.qubo")

# solve via PSO
x_s = hercules.pso(problem, 0, 10, 100)

§Errors

This function should never error, but if it does, it will abort.