-
Recent Posts
Recent Comments
- 店小二 on 论三座大山
- L on SVI模型拟合
- acnkid on 俄乌战争的回顾及其他
- acnkid on 外卖小哥的收入以及其他
- acnkid on 外卖小哥的收入以及其他
Archives
- June 2024
- April 2024
- January 2024
- October 2023
- September 2023
- August 2023
- June 2023
- May 2023
- February 2023
- January 2023
- October 2022
- September 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- December 2021
- October 2021
- September 2021
- August 2021
- June 2021
- May 2021
- April 2021
- January 2021
- December 2020
- September 2020
- August 2020
- May 2020
- April 2020
- May 2019
- March 2019
- February 2019
- January 2019
- September 2018
- July 2018
- May 2018
- April 2018
- December 2017
- November 2017
- August 2017
- July 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- September 2016
- August 2016
- July 2016
- June 2016
- March 2016
- January 2016
- October 2015
- July 2015
- May 2015
- November 2014
- August 2014
- July 2014
- March 2014
- February 2014
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- March 2013
- January 2013
- December 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- June 2010
- May 2010
- October 2009
- July 2009
- May 2009
- March 2009
- February 2009
- January 2009
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- April 2008
- November 2007
- April 2007
Categories
Meta
Tag Archives: 最优化
用matlab写单纯形表
今天在做最优化的题目的时候,遇到了些麻烦,单纯形表怎么写都会留下点问题,却找不出哪里出现了毛病,于是想用matlab将每一个单纯形表都画出来,但是程序写了会就写不下去了,主要是其中的逻辑判断,数字选择,让我有种无从下手的感觉,我把一些代码和注意点先贴到这里,等以后再试试,看看自己进步了没有。 Matlab语言 %purpose 验算手工单纯形 %写不下去了,还是等对于编程这些玩意更熟悉一些再弄,完全现在是不能转化成程序语言了 %define variables%C 目标函数变量系数 行向量%CB 辨识初始基 行向量%b 约束条件 列向量%A 约束系数矩阵 矩阵%delta 检验数 行向量%X 列向量 function [JI opt]=simplex(C,CB,b,A) theta=C-CB*A;if max(delta)<=0if all(CB<inf)if %存在非基变量的检验数为0%无穷多最优解 else %唯一最优解end elsedisp('无可行解')end elsethetaj=find(delta>0);%找出检验数为正的项temp1=A(:,deltaj);%找出检验数为正项对应的向量temp2=max(temp1);%找出检验数为正项对应的向量的每一列当中最大项if any(temp2<0) disp('无界解')else %单纯形变化[deltak,k]=max(delta);aik1=A(:,k)>0;baik=b./A() endend 下面就是搞的时候的一些注意点,自己查一下也很容易查到的地方。 matlab和excel差异:log含义不同,前者就是ln后者是以10为底 用最优化工具箱,没有x非负的设定,x的范围是自己写进去的.当然b也没有非零的设定 cat合并矩阵 逻辑数组逻辑数组有一个重要的属性它在算术运算中能提供一个屏蔽(mask). … Continue reading