Ejemplo n.º 1
0
 public function canLoad($pointSequence, $pythonFile, $loadArea, $weightCapacity, $allPoints)
 {
     $result = false;
     $points = self::removeDepotFromPointSequence($pointSequence);
     $boxFileName = dirname($pythonFile) . '/boxes.txt';
     if (!$this->getBoxesFileIsFilled()) {
         file_put_contents($boxFileName, IO::getBoxesTextForExternalPdpHelper($allPoints));
         $this->setBoxesFileIsFilled(true);
     }
     if (!file_exists($pythonFile)) {
         throw new \Exception("Python file '{$pythonFile}' does not exist!");
     }
     $cmdString = "python {$pythonFile}" . " -b {$boxFileName}" . " -n " . (int) (count($allPoints) / 2) . " -c \"" . implode(' ', $loadArea) . ' ' . $weightCapacity . "\"" . " -r \"" . implode(' ', Point::getPointIds($points)) . "  1\"" . " -p";
     $cmdResult = exec($cmdString);
     //  echo $cmdResult . "\n";
     $result = $cmdResult == 'True';
     return $result;
 }