简要介绍资料的主要内容,以获得更多的关注
:)))=1;
end
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x=rsimplex(c,A,b,l,u)
% x=rsimplex(c,A,b,l,u)
%
% This function applies the revised simplex method to the LP
%
% max c'x
% s.t. Ax=b
% l<=x<=u
% Get the problem size
[m,n]=size(A);
% Get a value for scaling:
sval=max([max(max(abs(A))),max(abs(b))])*1e5*eps;
% Set up the Phase 1 LP
% Create the augmented cost vector and constraint matrix
c1=zeros(m+n,1);
A1=[A,speye(m)];
% Assign the basic variables
bfs.B=n+1:n+m;
% Assign the nonbasic variables
bfs.N1=[];
bfs.N2=[];
bfs.N3=[];
bfs.x=zeros(n+m,1);
for j=1:n
if l(j)>-inf
bfs.x(j)=l(j);
bfs.N1=[bfs.N1,j];
elseif u(j)<inf
bfs.x(j)=u(j);
bfs.N2=[bfs.N1,j];
else
bfs.N3=[bfs.N3,j];
end
end
% Solve for the basic variables
bfs.x(n+1:n+m)=b-A*bfs.x(1:n);
% Create the extended constraints and
% define the extended cost vector
l1=[l;zeros(m,1)];
u1=[u;zeros(m,1)];
for i=1:m
if bfs.x(n+i)>=0
l1(n+i)=0;
u1(n+i)=inf;
c1(n+i)=-1;
else
l1(n+i)=-inf;
u1(n+i)=0;
c1(n+i)=1;
end
end
% Now invoke rsimplex_bfs to solve the Phase 1 LP
bfs=rsimplex_bfs(c1,A1,b,l1,u1,bfs);
% If the optimal value in Phase 1 is not zero, then the
% program is infeasible.
if any(abs(bfs.x(n+1:n+m))>sval)
error('The LP is infeasible')
% Otherwise, invoke Phase 2
else
% Change the bounds for the artificial variables
l1(n+1:n+m)=zeros(m,1);
u1(n+1:n+m)=zeros(m,1);
% Change the extended cost vector
c1=[c;zeros(m,1)];
% Apply the simplex method again
[bfs,tflag]=rsimplex_bfs(c1,A1,b,l1,u1,bfs);
x=bfs.x(1:n);
z=c'*x;
if tflag==1
error('The LP is unbounded')
end
end
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [bfs,tflag]=rsimplex_bfs(c,A,b,l,u,bfs);
% [bfs,termcode]=rsimplex_bfs(c,A,b,l,u,bfs);
%
% This function applies the revised simplex method to the LP
%
% max c'x
% s.t. Ax=b
% l<=x<=u
%
% An initial basic feasible solution bfs must be provided.
% The basic feasible solution is described by a structure
% containing the following fields
%
% bfs.x - the BFS itself (an n-vector)
% bfs.B - the index set for the basis
% bfs.N1 - the index set for the nonbasic variables at
% their lower bounds
% bfs.N2 - the index set for the nonbasic variables at
% their upper bounds
% bfs.N3 - the index set for the unrestricted nonbasic
% variables
% (The index sets are all row vectors.)
%
% The return code termcode indicates how the simplex method
% terminated:
%
% termcode==0 - Optimal solution found
% termcode==1 - LP is unbounded
% Get the problem size
[m,n]=si
MATLAB 有限元计算程序3_工学_高等教育_教育专区。有限元 matlab 程序设计function exam7_1 % 本程序为第七章的第一个算例,采用薄板矩形单元计算矩形板的弯曲 ...
关键词:力学matlab有限元有限单元法实例 同系列文档 朝鲜历届领导人资料 朝鲜现状 为什么南北朝鲜会分裂 朝鲜的近代史 matlab有限元计算程序5...
matlab计算有限元程序 (4) 2页 免费 MATLAB 有限元计算程序3 6页 2财富值 matlab计算有限元程序 (3) 1页 免费 MATLAB 有限元计算程序1 4页 2财富值...
matlab有限元法计算分析程序编写_机械/仪表_工程科技_专业资料。matlab应用有限元法计算分析程序编写 结构参数输入,包括 1)节点坐标值 2)单元类型以及连接信息 3)...
有限元 matlab 程序设计有限元 matlab 程序设计隐藏>> function exam8_1 % 本程序为第八章的第一个算例,采用平面梁单元计算两铰抛物线拱的自由振动特性 % ...
MATLAB 有限元计算程序3 6页 2财富值搜你所想,读你所爱 拒绝盗版,营造绿色文库 如要投诉违规内容,请到百度文库投诉中心;如要提出功能问题或意见建议,请点击...
Matlab 有限元法计算分析程序编写_交通运输_工程科技_专业资料。Matlab 有限元法计算分析程序编写有限元法计算分析程序编写 结构参数输入,包括 1)节点坐标值 2)...
梁单元的有限元计算程序%此程序计算杆的总刚度矩阵及节点位移,分五步完成:输入各单元数据、计算单元刚度矩阵 %组集总...
Matlab与有限元程序设计_工学_高等教育_教育专区。Matlab与有限元程序设计...编制的 聚合 物 口 模挤 出计 算机模 有限元程序设计 的方 法在 开 始...
热门文档