コード例 #1
0
ファイル: jsr331.php プロジェクト: hemantshekhawat/Snippets
 public function define()
 {
     $p = ProblemFactory::newProblem("Test");
     $x = $p->variable('X', 1, 10);
     $y = $p->variable('Y', 1, 10);
     $z = $p->variable('Z', 1, 10);
     $r = $p->variable('R', 1, 10);
     $vars = array($x, $y, $z, $r);
     $p->post($x, '<', $y);
     $p->post($z, '>', 4);
     $p->post($x->plus($y), '=', $z);
     $p->postAllDifferent($vars);
     $coef1 = array(3, 4, -5, 2);
     $p->post($coef1, $vars, '>', 0);
     $p->post($vars, '>=', 15);
     $coef2 = array(2, -4, 5, 1);
     $p->post($coef2, $vars, '>', $x->multiply($y));
     $this->problem = $p;
     $this->data = $vars;
 }