How to define multi variable linear programming ??

3 ビュー (過去 30 日間)
Ran Hu
Ran Hu 2018 年 11 月 16 日
回答済み: Alan Weiss 2018 年 11 月 16 日
For a random example:
Variable X from 1 to 3 and Z 0 to 2
I want to minimize 5*x1+2*x2+3*x3+Z0
and the constraints are:
3*x1+2*x2+4*x3-Z1+Z0>=15
10*x1+7*x2+6*x3-Z2+Z1>=10
5*x1+5*x2+5*x3+Z2>=8
X1,X2,X3,Z0,Z1,Z2 >= 0.
I have no problem defining the matrix if there were no Z variable and minimize it.
And I can get the minimized value using the function [x, fval] = linprog(c, A, b, Aeq, beq, lb, ub) where c what I want to minimize, A is the constraint matrix, b is the value of constraints, Aeq, Beq if LHS is only equal to RHS of constraints, lb is lower limite and ub is upper limit for the variables.
With the addition of the variable Z I am not sure how to define and optimize this problem.

回答 (2 件)

Torsten
Torsten 2018 年 11 月 16 日
編集済み: Torsten 2018 年 11 月 16 日
Set Z0 = x4, Z1= x5, Z2 = x6. Can you solve the problem now ?
  1 件のコメント
Ran Hu
Ran Hu 2018 年 11 月 16 日
yes, thought about it. but when when there are say x1 to x20, and z1 to z20. Just seems like the presentation is really bad. I can do x1 to x40. But doesnt look great..

サインインしてコメントする。


Alan Weiss
Alan Weiss 2018 年 11 月 16 日
You have two choices. One is to follow Torsten's advice and use linprog to solve the resulting problem.
The other is to use the new problem-based approach, which allows you to use any set of optimization variables that you like. For linear programming examples using this approach, see Problem-based Linear Programming Applications in Linear Programming and Mixed-Integer Linear Programming.
Alan Weiss
MATLAB mathematical toolbox documentation

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by