Function hercules::local_search::random_search

source ยท
pub fn random_search<T: Algorithm>(
    qubo: &Qubo,
    num_points: usize,
    prng: &mut PRNG<T>
) -> Array1<usize>
Expand description

Performs a random search on a QUBO, where points are randomly generated and the best point is returned. This to create a baseline to compare other algorithms against just random guesses.

Example:

use hercules::qubo::Qubo;
use smolprng::{PRNG, JsfLarge};
use hercules::{initial_points, utils};
use hercules::local_search;

// generate a random QUBO
let mut prng = PRNG {
  generator: JsfLarge::default(),
};
let p = Qubo::make_random_qubo(10, &mut prng, 0.5);

// perform random search with 1000 points
let x_sol = local_search::random_search(&p, 1000, &mut prng);