Function hercules::python_interopt::k_opt
source · pub fn k_opt(
problem: (Vec<usize>, Vec<usize>, Vec<f64>, Vec<f64>, usize),
fixed: HashMap<usize, usize>,
initial_guess: Option<Vec<usize>>
) -> PyResult<Vec<usize>>
Expand description
This function solves the QUBO using the k-opt algorithm and returns the best solution found.
Example
import hercules
# read in the QUBO from a file
problem = hercules.read_qubo("file.qubo")
# solve the QUBO using k-opt
x, obj = hercules.k_opt(problem, {}, initial_guess = None)
§Errors
This shouldn’t error, but if it does, it will abort.