Changing decision variables in linprog
5 views (last 30 days)
I am fixing an optimization problem and have a new situation in which I have 2 decision variables that are different for every instance from [0-200] and 1 decision variable which should not change. I am using lin prog. but I do not know how to code this, as linprog normally just optimizes regarding Y,X,Z instead of in my case Y(k),Z(k) and X.
My code is:
% linprog loop to optimize multiple instances of the problem.
l = 1;
q = 11;
s = 2;
A1 = 1;
f2 = [c',pk(k)*-s.',pk(k)*(l-q).']; % or [c',-s.',(l-q).']
Aeq = [-1,1,A1.']; %[x y z] --> Want it to be [X Y(k) Z(k)]
beq = ;
lb = [0,0,0];
ub = [inf,inf,k];
sol = linprog(f2,,,Aeq,beq,lb,ub);
y(k) = sol(2);
z(k) = sol(3);
constraint that I holds for this problem is Y(k)+A1.'*Z(k)=X I changed it around to Y(k)+A1.'*Z(k)-X=0 as beq can only hold a value and not a variable X. When I run this code the output is zero for every instance. This shouldn't be the case. Does anyone know what I am doing.
I would like to get in the constraint that Y and Z change for every instance of K and that X holds the same value for every instance.
I hope this is possible.