Function snowcap::synthesize_parallel[][src]

pub fn synthesize_parallel(
    net: Network,
    config_a: Config,
    config_b: Config,
    hard_policy: HardPolicy,
    time_limit: Duration,
    n_threads: Option<usize>
) -> Result<Vec<ConfigModifier>, Error>
Expand description

Synthesize Configuration Updates using multiple parallel threads

This funciton spawns N StrategyTRTA threads, that search for a solution in parallel, using different random seeds.. The first solution found will be used, and all other threads will be killed.

Usage

use snowcap::hard_policies::*;
use snowcap::synthesize_parallel;
use snowcap::Error;
use snowcap::netsim::Network;
use snowcap::netsim::config::Config;
use std::time::Duration;

fn main() -> Result<(), Error> {
    // prepare the network
    // let net = ...
    // let initial_config = ...
    // let final_config = ...

    // prepare the policies
    // let hard_policy = ...

    // synthesize the reconfiguration
    let sequence = synthesize_parallel(
        net,
        initial_config,
        final_config,
        hard_policy,
        Duration::from_secs(60),
        None
    )?;

    Ok(())
}