PHP Classes

need help

Recommend this page to a friend!

      PHP Simplex Solver  >  All threads  >  need help  >  (Un) Subscribe thread alerts  
Subject:need help
Summary:cant solve problem with zero constraint
Messages:2
Author:klavlove
Date:2017-05-02 13:40:35
 

  1. need help   Reply   Report abuse  
Picture of klavlove klavlove - 2017-05-02 13:40:35
Hi,

first of all, thank you for the package its awesome!
im trying to solve simple problem like this one:
Max X1+X2+X3
S.T
X1+X2+X3<=3
0<=X1<=1
0<=X2<=0
0<=X3<=1

its suppose to give me z=2 and X1=1,X3=1

the result he give is:
z=1 and x1=1

my change at data.php:

//TEST DATA 1:
$leftdata=array
(
array(1,1,1),
array(1,0,0),
array(0,1,0),
array(0,0,1)

); // Persamaan disebelah kiri

$rightdata=array(3,1,0,1); //nilai sebelah kanan <- Subject to constraint

$zdata=array(1,1,1); // Persamaan Maximum atau minimum

what am i doing wrong?

Thanks =]

  2. Re: need help   Reply   Report abuse  
Picture of donni ansyari donni ansyari - 2017-08-01 17:06:04 - In reply to message 1 from klavlove
Hi,

The requirements for TSimplex.class are all variable statements can not be empty.

[from your statemens]
S.T
X1+X2+X3<=3
0<=X1<=1 <--- the codes can not execute
0<=X2<=0 <--- the codes can not execute
0<=X3<=1 <--- the codes can not execute


here is the correct one for example that codes can execute :
X1+X2+X3<=3
2X1+X2+3X3<=4
X1+2X2+X3<=2

warm regards,