What is the plan
In the context of limited resources, doing the most meaningful thing, in fact, planning.
Small example
For example, I want to cover the building, I have so much money, I would ask people design, buy equipment, buy material resources, how should we balance the money spent, it makes the completion of the building cover.
Mathematical programming model how classification
a. linear programming model
Example primers (production planning): factory using a, b, c three kinds of raw materials A, B, C three products, each product production are known in the technical conditions and the profit per unit consumption of raw materials of the product, and amount of various raw materials can be used (specifically, the data in the table below), the test plan development of appropriate production plant such that the total maximum profit.
- We want to generate a number of pieces of A, B, C such that the total profit of the plant's maximum.
- First, we assume
x1=1,x2=1 is a feasible point.
- All in R are feasible point.
- where z is the first and $ x_1.
- General vertex point is the optimal value.
- They can put all the vertices are counted again.
Software Solutions
- The following code is copied directly into the lingo
model: !程序开始
sets: !变量集合开始
var/1..2/:x; !说明x是二维变量
endsets !集合说明结束
max=4*x(1)+3*x(2); !目标函数求极大
2*x(1)+x(2)<=10; !约束函数
x(1)+x(2)<=8; !约束函数
x(2)<=7; !约束函数
End !程序结束 如果不加以
说明,LINGO认为所有变量非负
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Output
Global optimal solution found.
Objective value: 26.00000
Infeasibilities: 0.000000
Total solver iterations: 2
Model Class: LP
Total variables: 2
Nonlinear variables: 0
Integer variables: 0
Total constraints: 4
Nonlinear constraints: 0
Total nonzeros: 7
Nonlinear nonzeros: 0
Variable Value Reduced Cost
X( 1) 2.000000 0.000000
X( 2) 6.000000 0.000000
Row Slack or Surplus Dual Price
1 26.00000 1.000000
2 0.000000 1.000000
3 0.000000 2.000000
4 1.000000 0.000000
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- The first exercise is solved by lingo after class.
Example 2 (thinking difficult, to think about their own)
A shop that required over the next five days some statistics are shown in Table tool. Each tool costs to 0.6 yuan. Tool used to send repair workshop mill, each of the takes 0.2 yuan. A day after the use of the tool, if immediately sent to the mill can grind two days after a good return for the needs of the day. After the fifth day, the tool of all the new ones. Assuming the beginning, the shop does not have any tools. Q. How many knives in order to meet the needs of this workshop needs, while cost and lowest
answer
- 10≤x14+x24≤. 5 0 D cell
Enter the lingo
model:
sets:
kar/1..3/;
car/1..4/;
var(kar,car):x;
endsets
min=160*x(1,1)+130*x(1,2)+220*x(1,3)+
170*x(1,4)+140*x(2,1)+130*x(2,2)+190*x(2,3)
+150*x(2,4)+190*x(3,1)+200*x(3,2)+230*x(3,3);
x(1,1)+x(1,2)+x(1,3)+x(1,4)=50;
x(2,1)+x(2,2)+x(2,3)+x(2,4)=60;
x(3,1)+x(3,2)+x(3,3)=50;
x(1,1)+x(2,1)+x(3,1)<=80;
x(1,1)+x(2,1)+x(3,1)>=30;
x(1,2)+x(2,2)+x(3,2)<=140;
x(1,2)+x(2,2)+x(3,2)>=70;
x(1,3)+x(2,3)+x(3,3)<=30;
x(1,3)+x(2,3)+x(3,3)>=10;
x(1,4)+x(2,4)<=50;
x(1,4)+x(2,4)>=10;
End
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
come to conclusion
Global optimal solution found.
Objective value: 340.0000
Infeasibilities: 0.000000
Total solver iterations: 0
Model Class: LP
Total variables: 5
Nonlinear variables: 0
Integer variables: 0
Total constraints: 6
Nonlinear constraints: 0
Total nonzeros: 14
Nonlinear nonzeros: 0
Variable Value Reduced Cost
X1 120.0000 0.000000
X2 85.00000 0.000000
X3 40.00000 0.000000
X4 60.00000 0.000000
X5 140.0000 0.000000
Row Slack or Surplus Dual Price
1 340.0000 -1.000000
2 0.000000 -0.2000000
3 0.000000 -0.2000000
4 0.000000 -0.2000000
5 0.000000 -0.6000000
6 0.000000 -0.6000000
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
问题讨论
- 当每个水库最大供水量都提高了一倍会发生什么?
- 这时候不再是供大于求了,这应该怎么做呢?
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e44c3c0e64.css" rel="stylesheet">
</div>
什么是规划
在有限的资源状况下,干最有意义的事,其实就是规划。
小例子
例如我要盖大楼,我有这么多钱,我要请人设计、买设备、买材料资源,我们应该怎么平衡钱的花费,使得完成盖大楼这件事。
数学规划模型怎么分类
a. 线性规划模型
引例(生产规划问题):某厂利用a、b、c三种原料生产A、B、C三种产品,已知生产每种产品在消耗原料方面的各项技术条件和单位产品的利润,以及可利用的各种原料的量(具体数据如下表),试制订适当的生产规划使得该厂的总的利润最大。
- 我们要生成多少件A、B、C使得该厂的总利润最大。
- 首先我们假设
x1=1,x2=1 is a feasible point.
- All in R are feasible point.
- where z is the first and $ x_1.
- General vertex point is the optimal value.
- They can put all the vertices are counted again.
Software Solutions
- The following code is copied directly into the lingo
model: !程序开始
sets: !变量集合开始
var/1..2/:x; !说明x是二维变量
endsets !集合说明结束
max=4*x(1)+3*x(2); !目标函数求极大
2*x(1)+x(2)<=10; !约束函数
x(1)+x(2)<=8; !约束函数
x(2)<=7; !约束函数
End !程序结束 如果不加以
说明,LINGO认为所有变量非负
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Output
Global optimal solution found.
Objective value: 26.00000
Infeasibilities: 0.000000
Total solver iterations: 2