谁帮忙写下matlab程序..

[复制链接]
查看11 | 回复2 | 2011-5-3 12:52:54 | 显示全部楼层 |阅读模式
目标:Minz= x1+x2+x3+x4
约束:S.t
2*x1+x2+x3 >=10000
2*x2+ 2*x4 >=10000
x1+ 3*x3+2*x4 >=10000
x1,x2,x3,x4, >=0

回复

使用道具 举报

千问 | 2011-5-3 12:52:54 | 显示全部楼层
f=[1;1;1;1];A=[-2 -1 -1 0;0 -2 0 -2;-1 0 -3 -2];b=[-10000;-10000;-10000];lb=zeros(4,1);[x,fval,exitflag] = linprog(f,A,b,[],[],lb)Optimization terminated.x =1.0e+003 *
2.7042
3.2958
1.2958
1.7042fval =9.0000e+003exitflag =
1
回复

使用道具 举报

千问 | 2011-5-3 12:52:54 | 显示全部楼层
运行过的和书本给的答案完全一样#include "stdio.h" main() { float sum=0;//注意类型对应否则出错 float mother=1,son=2; int i,temp; for(i=1;i<=20;i++) { sum=sum+son/mother; temp=son;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行