예제 #1
0
 static function treeSearchApproachBackEnd(&$placements, &$nvms, &$maxVM, &$level = 0, &$usageVector = array(), &$stateCounter = 0)
 {
     //Interects foreach possible placements of that VM
     foreach ($placements[$level] as $p) {
         $pmName = explode(':', $p)[1];
         //Checks if the PM is not full
         if ($usageVector[$pmName] < $maxVM) {
             //Check if the last VM to host
             if ($level >= $nvms - 1) {
                 //Just count one state
                 $stateCounter++;
             } else {
                 //Prepare to drilldown
                 $level++;
                 $usageVector[$pmName]++;
                 Approximation::treeSearchApproachBackEnd($placements, $nvms, $maxVM, $level, $usageVector, $stateCounter);
                 $level--;
                 $usageVector[$pmName]--;
             }
         }
     }
     return $stateCounter;
 }