Function snowcap::optimize[][src]

pub fn optimize<SP: SoftPolicy + Clone>(
    net: Network,
    config_a: Config,
    config_b: Config,
    hard_policy: HardPolicy,
    time_limit: Option<Duration>
) -> Result<(Vec<ConfigModifier>, f64), Error>
Expand description

Synthesize Configuration Updates while optimizing soft policies

This is the main function to interact with the system. It uses the OptimizerTRTA.

Usage

use snowcap::hard_policies::*;
use snowcap::soft_policies::*;
use snowcap::optimize;
use snowcap::Error;
use snowcap::netsim::Network;
use snowcap::netsim::config::Config;

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

    // prepare the policies
    // let hard_policy = ... (e.g., HardPolicy::reachability(...))
    // type SP = ... (e.g., MinimizeTrafficShift)

    // synthesize the reconfiguration
    let (sequence, _) = optimize::<SP>(net, initial_config, final_config, hard_policy, None)?;

    Ok(())
}