Hi. I’m trying to rewrite linear programming code from mathlab to scilab, but linprog is not working here. Original MathLab:
c = [-8 -5];
A = [-1 5; -3 1; 1 -2];
b = [6 -19 8];
Aeq = [-4 1];
beq = [20];
lb = zeros(2, 1);
f = -c;
[x,fval,exitflag] = linprog(f, A, b, Aeq, beq, lb)
How can I rewrite this for scilab? I tried but i got an error: Undefined variable: linprog
c=[-8,-5]
A=[-1,5;-3,1;1,-2]
b=[6,-19,8]
Aeq = [-4,1]
beq = [20]
lb = zeros(2,1)
f = -c
[xopt,fopt,exitflag,output,lambda]=linprog(f, A, b, Aeq, beq, lb)
Undefined variable: linprog
Hello,
Scilab does not have “linpro” but has “karmarkar” to solve linear programs. See
https://help.scilab.org/docs/2024.0.0/en_US/karmarkar.html
S.
Thank you. Maybe you can help me with this error I keep getting, because I don’t understans what’s wrong.
c=[-8,-5]
A=[-1,5;-3,1;1,-2]
b=[6,-19,8]
Aeq = [-4,1]
beq = [20]
lb = zeros(2,1)
f = -c
[xopt,fopt,exitflag,output,lambda]=karmarkar(f, A, b, Aeq, beq, lb)
at line 108 of function karmarkar
karmarkar: Wrong size for input argument #2.
Just read the help page which gives you the arguments, which are not the same as Matlab’s linprog.
S.