資源簡介
matlab 源代碼 線性規劃 經典奉獻

代碼片段和文件信息
function??[xminf]?=?CmpSimpleMthd(AcbbaseVector)
sz?=?size(A);
nVia?=?sz(2);
n?=?sz(1);
xx?=?1:nVia;
nobase?=?zeros(11);
m?=?1;
if?c>=0
????vr?=?find(c~=0?1‘last‘);
????rgv?=?inv(A(:(nVia-n+1):nVia))*b;
????if?rgv?>=0
????????x?=?zeros(1vr);
????????minf?=?0;
????else
????????disp(‘不存在最優解!‘);
????????x?=?NaN;
????????minf?=?NaN;
????????return;
????end
end
for?i=1:nVia
????if(isempty(find(baseVector?==?xx(i)1)))
????????nobase(m)?=?i;
????????m?=?m?+?1;
????else
????????;
????end
end
bCon?=?1;
M?=?0;
while?bCon
????nB?=?A(:nobase);
????ncb?=?c(nobase);
????B?=?A(:baseVector);
????cb?=?c(baseVector);
????xb?=?inv(B)*b;
????f?=?cb*xb;
????w?=?cb*inv(B);
????for?i=1:length(nobase)
????????sigma(i)?=?w*nB(:i)-ncb(i);
????end
????[maxsind]?=?max(sigma);
????if?maxs?<=?0
????????minf?=?cb*xb;
????????vr?=?find(c~=0?1‘last‘);
????????for?l=1:vr
????????????ele?=?find(baseVector?==?l1);
????????????if(isempty(ele))
????????????????x(l)?=?0;
????????????else
????????????????x(l)=xb(ele);
????????????end
????????end
????????bCon?=?0;
????else
????????y?=?inv(B)*A(:nobase(ind));
????????if?y?<=?0
????????????disp(‘不存在最優解!‘);
????????else
????????????minb?=?inf;
????????????chagB?=?0;
????????????for?j=1:length(y)
????????????????if?y(j)>0
????????????????????bz?=?xb(j)/y(j);
????????????????????if?bz ????????????????????????minb?=?bz;
????????????????????????chagB?=?j;
????????????????????end
????????????????end
????????????end
????????????tmp?=?baseVector(chagB);
????????????baseVector(chagB)?=?nobase(ind);
????????????nobase(ind)?=?tmp;
????????end
????end
????M?=?M?+?1;
????if?(M?==?1000000)
????????disp(‘找不到最優解!‘);
????????x?=?NaN;
????????minf?=?NaN;
????????return;
????end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1836??2008-05-28?19:54??第10章?線性規劃\CmpSimpleMthd.m
?????文件?????????347??2009-10-28?19:23??第10章?線性規劃\Funval.m
?????文件????????2269??2008-06-01?15:22??第10章?線性規劃\ModifSimpleMthd.m
?????文件????????1645??2008-05-28?19:56??第10章?線性規劃\SimpleMthd.m
?????文件?????????940??2009-10-30?00:08??第10章?線性規劃\TranfmAcb.m
?????目錄???????????0??2011-08-08?23:10??第10章?線性規劃\
- 上一篇:基于labview的溫控爐控制系統程序
- 下一篇:時間序列預測及matlab代碼
評論
共有 條評論