function solveGraph()
{
    if (!isset($_GET["graph"])) {
        echo "Please specify the current graph!";
        return;
    }
    $h = new Hungarian($_GET["graph"]);
    echo $h->solve();
}
Esempio n. 2
0
 function testWriteIntAsText()
 {
     $this->assertEquals('négyszázhatvanötmillió-százhuszonháromezer-hétszáznyolcvankilenc', $this->object->writeIntAsText(465123789));
     $this->assertEquals('ötszáz', $this->object->writeIntAsText(500));
     $this->assertEquals('ezerötszáz', $this->object->writeIntAsText(1500));
     $this->assertEquals('kétezer-ötszáz', $this->object->writeIntAsText(2500));
     $this->assertEquals('tízmillió-kilencvenhat', $this->object->writeIntAsText(10000096));
 }
function solveGraph()
{
    if (isset($_GET["graph_id"])) {
        $graphId = $_GET["graph_id"];
        if ($graphId < 1 || $graphId > 9) {
            echo "invalid graph ID!";
            return;
        }
        $tc = new GraphTestCase();
        $currGraphJson = $tc->jsonArray[$graphId - 1];
        $h = new Hungarian($currGraphJson, false);
        echo $h->solve();
    } else {
        if (isset($_GET["graph"])) {
            $h = new Hungarian($_GET["graph"], true);
            echo $h->solve();
        } else {
            echo "Please specify the current graph!";
            return;
        }
    }
}