Exemple #1
0
}
if (!file_exists(FNSC)) {
    convertPlacementToScenario();
}
$pms = json_decode(file(FNPM)[0], true);
$vms = json_decode(file(FNVM)[0], true);
$scenario = json_decode(file(FNSC)[0], true);
$tmp = array();
foreach ($vms as $vm) {
    $tmp[$vm['name']] = 0;
}
$fmt = "\nVM-UUIDs(%s) | VM-Names(%s) | PMs(%s) | PossiblePlaces(%s) | APR(%s)\n";
echo sprintf($fmt, count($vms), count($tmp), count($pms), array_sum($scenario['rpm']), array_sum($scenario['rpm']) / (count($tmp) * count($pms)));
$semConstraint = Approximation::calcularComRegras($scenario);
echo "With Rules:" . $semConstraint . PHP_EOL;
$result = Approximation::realTreeSearchApproach($scenario);
echo "Real Possibilities: " . $result . PHP_EOL;
function sig_handler($signo)
{
    global $ctd;
    echo 'Estados ' . $ctd . PHP_EOL;
    die;
}
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGTERM, "sig_handler");
function convertPlacementToScenario()
{
    $placements = json_decode(file(FNPL)[0], true);
    $scenario = Scenario::buildScenarioByPlacements($placements);
    $scenario['vms'] = json_decode(file(FNVM)[0], true);
    $scenario['pms'] = json_decode(file(FNPM)[0], true);