I am new in Scilab, I am planning to use it to do the linear programming. I googled and found this code:
Aeq = [
2 0 6
0 3 5
];
beq = [8;15;30];
c = [30;50];
[xopt]=karmarkar(Aeq,beq,c);
But it seems there is a problem with the karmarkar. Can anyone tell me how to fix my problem? I tried to use help karmarkar
because I think it might be the same with Matlab but it didn't work.
The parameters Aeq
and beq
represent linear equality constraints. Each row of Aeq
has the coefficients of an equation, and the corresponding row of beq
is the right hand side. Therefore, the number of rows in Aeq
and beq
must be the same.
Also, the number of rows of c
must be equal to the number of variables you have, in this case three.
To summarize: when you have m constraints and n variables, the matrices have the following sizes:
Aeq
is m by n beq
is m by 1c
is n by 1Working example:
Aeq = [
2 0 6
0 3 5
]
beq = [8;15]
c = [30;50;70]
[xopt]=karmarkar(Aeq,beq,c)