24小时热门版块排行榜    

查看: 3857  |  回复: 0

freesea

铁虫 (初入文坛)

[求助] 【请教】matlab求解含等式约束线性规划的对偶问题

The problem:
              min x1+3*x2+0.5*x3
               s.t. x1<=2;
                  x1+x2-x3=3;
                 x1,x2,x3>=0
                     
Correct solution is x1=2; x2=1; x3=0; dual solution is  y=(-2; 3)
I have made the following code, but the result of dual solution obtained from “lambda” is not correct.

clear
% Parameters
N=3;f=[1; 3; 0.5];lb=zeros(N,1);
% Define Matrices
A=[1 0 0];b=[2];
Aeq=[1 1 -1];beq=[3];
[x,fval,exitflag,output,lambda]=linprog(f,A,b,Aeq,beq,lb,[])

When the quality is transformed into inequality, the corresponding code is shown as follows:
clear
% Parameters
N=3;f=[1; 3; 0.5];lb=zeros(N,1);
% Define Matrices
A=[1 0 0;1 1 -1;-1 -1 1];b=[2;3;-3];
[x,fval,exitflag,output,lambda]=linprog(f,A,b,[],[],lb,[])

These two paragraphs of codes can only get the correct answer to the primal problem, but they cannot get the right solution of dual problem. Could you tell me how to get to correct dual solution? Thanks a lot.
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

找到一些相关的精华帖子,希望有用哦~

科研从小木虫开始,人人为我,我为人人
相关版块跳转 我要订阅楼主 freesea 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 326求调剂 +4 上岸的小葡 2026-03-15 5/250 2026-03-16 08:39 by Linda Hu
[考研] 化学调剂0703 +7 啊我我的 2026-03-11 7/350 2026-03-15 23:03 by 凌千颂111
[考研] 327求调剂 +6 拾光任染 2026-03-15 11/550 2026-03-15 22:47 by 拾光任染
[基金申请] 国自科面上基金字体 +4 iwuli 2026-03-12 5/250 2026-03-15 17:07 by 风云无泪
[考研] 328求调剂 +3 5201314Lsy! 2026-03-13 6/300 2026-03-14 15:31 by hyswxzs
[考研] 211本,11408一志愿中科院277分,曾在中科院自动化所实习 +3 Losir 2026-03-12 3/150 2026-03-14 12:11 by 热情沙漠
[考研] 308求调剂 +4 是Lupa啊 2026-03-09 4/200 2026-03-14 02:06 by tranquil_ya
[考研] 招收0805(材料)调剂 +3 18595523086 2026-03-13 3/150 2026-03-14 00:33 by 123%、
[考研] 复试调剂 +9 Copy267 2026-03-10 9/450 2026-03-13 23:45 by userper
[考研] 材料与化工304求B区调剂 +5 邱gl 2026-03-11 6/300 2026-03-13 22:37 by JourneyLucky
[考研] 0703,333分求调剂 一志愿郑州大学-物理化学 +3 李魔女斗篷 2026-03-11 3/150 2026-03-13 22:24 by JourneyLucky
[考研] 308求调剂 +5 是Lupa啊 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[考研] 材料工程调剂 +9 咪咪空空 2026-03-12 9/450 2026-03-13 22:05 by 星空星月
[考研] 293求调剂 +3 世界首富 2026-03-11 3/150 2026-03-13 16:27 by JourneyLucky
[考研] 求b区学校调剂 +3 周56 2026-03-11 3/150 2026-03-13 16:20 by JourneyLucky
[考研] 302求调剂 +6 负心者当诛 2026-03-11 6/300 2026-03-13 16:11 by JourneyLucky
[考研] 285求调剂 +4 ytter 2026-03-12 4/200 2026-03-13 14:48 by jxchenghu
[考研] 304求调剂(085602一志愿985) +12 化工人999 2026-03-09 12/600 2026-03-13 12:02 by JourneyLucky
[考研] 289求调剂 +3 李政莹 2026-03-12 3/150 2026-03-13 11:02 by 求调剂zz
[考研] 321求调剂(食品/专硕) +3 xc321 2026-03-12 6/300 2026-03-13 08:45 by xc321
信息提示
请填处理意见