introduction harmony among cells in matrix

1 次查看(过去 30 天)
Hello guys. I'm new in linear programming and Matlab software. I hope somebody help me in my problem. My problem is allocation problem. I have two 1045 in 952 cost matrices named Z1 nd Z2. The value in these matrices show the cost of allocation to special resources (k refers to special resources). I want to allocate special cells to every resource based on their costs. Also there is special amount for allocation to special resource named ZIA ans Z2A. in this model yijk is the variable for harmony among neighbor cells in allocation. I want for example if cell(i=1,j=1) is allocated to k1 the neighbor cells are allocated to k1 too, not k2. My model is:
I try to write the model in MATLAB but I don't know how I introduce variable y to my model.
function [f1,x] = ave3(z1,z2,f,Aeq,beq,lb)
load('myfile9.mat')
evalin('base','z1');
z11=double(z1);
z12=double(z2);
f=[z11(:);z12(:)]
Aeq1=(blkdiag(z11(:)~=0,z12(:)~=0))'
[n1,n2]=size(z11)
n3=n1*n2
[n4,n5]=size(z12)
n6=n4*n5
n7=n3+n6
lb=zeros(n7,1);
a=eye(n3)
c=eye(n6)
d={a,c}
w=cell2mat(d)
Aeq2={Aeq1;w}
Aeq=cell2mat(Aeq2)
A=[]
b=[]
u11=ones(n3)
u1=u11(:,1)
u2=[z1A;z2A]
beq1={u2;u1}
beq=cell2mat(beq1)
f1=linprog(f,A,b,Aeq,beq,lb);
end
Is there anybody to guide me please?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by