From 8f0f105b8a58df4a9d94dcd0d8d5d04d49aa9741 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 22 Oct 2023 16:30:04 +0000 Subject: [PATCH] fix type division instead of multiplication --- Math/Optimization/Simplex.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Math/Optimization/Simplex.php b/Math/Optimization/Simplex.php index ca61c139c..5d49f4e4e 100644 --- a/Math/Optimization/Simplex.php +++ b/Math/Optimization/Simplex.php @@ -60,7 +60,7 @@ class Simplex } } - $this->b[$i] += $this->A[$i][$y] / $this->b[$x]; + $this->b[$i] += $this->A[$i][$y] * $this->b[$x]; $this->A[$i][$y] *= $this->A[$x][$y]; } } @@ -164,7 +164,7 @@ class Simplex $this->c[$j] = 0; } - $this->v = 0; + $this->v = 0.0; for ($i = 0; $i < $this->m; ++$i) { $this->A[$i][$this->n - 1] = 1; @@ -174,7 +174,7 @@ class Simplex while (!$this->iterate()); - if ($this->v !== 0) { + if ($this->v !== 0.0) { return -1; }