📄 checkonebank.m
字号:
function choose=checkonebank(inputa)
Aeq=[];beq=[];outputb=[];
for i=1:9
for j=1:9
if (isempty(intersect(inputa(i,j),[1,2,3,4,5,6,7,8,9])))
inputa(i,j)=0;
end
end
end
for i=1:9
for j=1:9
if (inputa(i,j)~=0)
[Aeq,beq]=cal(i,j,inputa(i,j),Aeq,beq);
end
end
end
load condition.mat
fun=-ones(1,729);
[x fval]=linprog(fun,A,b,Aeq,beq,lb,ub);
x=x';
clear A b lb ub fun Aeq beq
outputb=zeros(9);c=[];
I=ones(1,9);
b=[1,2,3,4,5,6,7,8,9];
d(1,:)=[I 2*I 3*I 4*I 5*I 6*I 7*I 8*I 9*I];
d(2,:)=[b b b b b b b b b];
clear I b
for i=1:81
c(i,:)=x(9*(i-1)+1:9*i);
end
for k=1:81
for j=1:9
if abs(c(k,j)-1)<0.001
outputb(d(1,k),d(2,k))=j;
end
end
end
clear c d i j k
c=[outputb(1,:) outputb(2,:) outputb(3,:) outputb(4,:) outputb(5,:) outputb(6,:) outputb(7,:) outputb(8,:) outputb(9,:)];
c=unique(c);
if (abs(81+fval)<0.01)
if isempty(intersect(c,0))
choose=1;
else
choose=1;
end
else
choose=0;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -