c=[-10,-9]; A=[6 5;10 20;1 0]; b=[60;150;8]; vlb=zeros(2,1); Aeq=[]; beq=[]; vub=[]; [x,fval]=linprog(c,A,b,Aeq,beq,vlb,vub);
时间: 2024-05-25 16:19:12 浏览: 81
C语言编程,1-10的阶乘
The solution to this linear programming problem can be obtained using the linprog function in MATLAB. The input parameters to the function are:
- c: The coefficient vector of the linear objective function.
- A: The coefficient matrix of the linear inequality constraints.
- b: The right-hand side vector of the linear inequality constraints.
- Aeq: The coefficient matrix of the linear equality constraints.
- beq: The right-hand side vector of the linear equality constraints.
- vlb: The lower bound vector for the decision variables.
- vub: The upper bound vector for the decision variables.
The output parameters of the function are:
- x: The optimal solution vector.
- fval: The optimal value of the objective function.
In this case, the input parameters are:
c = [-10,-9];
A = [6 5;10 20;1 0];
b = [60;150;8];
vlb = zeros(2,1);
Aeq = [];
beq = [];
vub = [];
And the function call is:
[x,fval] = linprog(c,A,b,Aeq,beq,vlb,vub);
The optimal solution vector is:
x = [5.4545; 2.7273]
And the optimal value of the objective function is:
fval = - 90.0000
Therefore, the optimal values for the decision variables are x1 = 5.4545 and x2 = 2.7273, and the optimal value of the objective function is -90.
阅读全文