线性规划工具箱使用。
显示 更早的评论
clc, clear, c=[3, -1, -1];
a=[1, -2, 1; 4, -1, -2]; b=[11,-3]';
prob = optimproblem('ObjectiveSense','max');
x = optimvar('x',3,'LowerBound',0);
prob.Objective = c*x;
prob.Constraints.con1 = a*x<=b;
prob.Constraints.con2 = -2*x(1)+x(3)==1;
[sol, fval, flag, out] = solve(prob)
xx = sol.x %显示决策变量的值
未定义函数或变量 'optimproblem'。
书上的代码粘过来的,直接运行不了,百度过只知道是工具箱的问题,但是不知道如何解决
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 线性最小二乘 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!