GLPK Summary

'.$modeltitle.''; if ($showinput) { echo '

Input model:

'; echo '

'.nl2br($lpmodel).'' ; } $tempinput = tempnam("/tmp","glp"); $fp = fopen($tempinput,'w'); $lpinp = str_replace("\r","",$lpmodel); // echo "

$lpmodel
"; $i = fwrite($fp, $lpmodel); fclose($fp); $tempsolver = tempnam("/tmp","glp"); $command = './glpsol --name ORtoolkit.com --math '.$tempinput; $showcmd = 'cat '; if ($showmodel) { $tempmodel = tempnam("/tmp","glp"); $command = $command.' --wcpxlp '.$tempmodel; $showcmd = $showcmd.$tempmodel.' '; } if ($showsolver) { $showcmd = $showcmd.$tempsolver.' '; } if ($showsolution) { $tempsolution = tempnam("/tmp","glp"); $command = $command.' -o '.$tempsolution; $showcmd = $showcmd.$tempsolution.' '; } if ($showsens) { $tempsens = tempnam("/tmp","glp"); $command = $command.' --bounds '.$tempsens; $showcmd = $showcmd.$tempsens.' '; } $command = $command.' >'.$tempsolver; ?>

GLPK output:

$command"; $myoutput = shell_exec($command); // echo "
$$showcmd
"; $myoutput = shell_exec($showcmd); echo "
$myoutput
"; unlink($tempinput); unlink($tempsolver); if ($showmodel) unlink($tempmodel); if ($showsolution) unlink($tempsolution); if ($showsens) unlink($tempsens); ?>