Current location - Training Enrollment Network - Mathematics courses - How to make linear programming model with matlab
How to make linear programming model with matlab
1 linear programming model; 1. Linear programming topic: Example 1: Production planning problem; Suppose a factory plans to produce two kinds of products, A and B, and the main materials in stock are: establish a mathematical model: let x 1, and x2 be the number of products produced by A and B respectively; maxf = 70x 1+ 120 x2; s . t9x 1+4x 2≤3600; 4x 1+5 x2≤2000; 3x 1+ 10 x2≤3000; x 1,x2≥0; It boils down to a programming problem: the objective function and constraints are lines of variable X; Shape: (1

1 linear programming model

A, linear programming topic:

Example 1: production planning problem

Suppose a factory plans to produce two kinds of products, A and B. The main materials in stock are A 3600kg, B 2000kg and C 3000kg. Each A product needs 9 kg of materials of Class A, 4 kg of materials of Class B and 3 kg of materials of Class C. Each B product needs 4 kg of materials of Class A, 5 kg of materials of Class B, and materials of Class C10 kg ... 70 yuan, a unit product profit. Ask how to arrange production in order to maximize the profit of this factory.

Establish a mathematical model:

Let x 1 and x2 be the product quantities produced by Party A and Party B respectively. F is the total profit made by this factory.

Maximum f=70x 1+ 120x2.

s.t 9x 1+4x2≤3600

4x 1+5x2≤2000

3x 1+ 10x2≤3000

x 1,x2≥0

It boils down to a programming problem: both the objective function and the constraint conditions are linear functions of the variable X.

Shape: (1) minimum f T X

Standard time A X≤b

Aeq X =beq

lb≤X≤ub

Where x is an n-dimensional unknown vector, f T=[f 1, f2, …fn] is the objective function coefficient vector, the constraint coefficient matrix A is less than or equal to m×n matrix, b is the right m-dimensional column vector, Aeq is the equality constraint coefficient matrix, and beq is the right constant sequence vector constrained by equality. Lb and UB are n-dimensional constant vectors with upper and lower bounds of independent variables.

2. The function of finding the optimal solution of linear programming problem:

Call format: x=linprog(f, a, b)

x=linprog(f,A,b,Aeq,beq)

x=linprog(f,A,b,Aeq,beq,lb,ub)

x=linprog(f,A,b,Aeq,beq,lb,ub,x0)

x=linprog(f,A,b,Aeq,beq,lb,ub,x0,options)

[x,fval]=linprog(…)

[x,fval,exitflag]=linprog(…)

[x,fval,exitflag,output]=linprog(…)

[x,fval,exitflag,output,lambda]=linprog(…)

Description: x=linprog(f, a, b) The return value x is the optimal solution vector.