البرمجة الخطية أو البرمجة الرياضية...ÿ The table shows data problem:...

16
1 Mathematical Programming : Introduction البرمجةاضية الري تعرف بأنهاعلم ال الذي يبحث في تحديد القيمة العظمى أو القيمة الصغرى لدالةده محد تسمى دالة الهدف( (Objective function . ت البرمجة تطبيقااضية الري: 1 . يم تصمتلمفاع الكيميائية ا. ٢ . صناعةستيك الب3 . يم تصم محر ك اتئراتلطا ا4 . يم تصملمباني االجسور و٥ . مسائلنقل النتاج وا. وهناكمات استخدالبرمجة لاضية الري فييلتحل الدي العد( تلمعاد اتفاضلية اللعادية ا غير الخطية) : programming mathematical for The general formula Minimization or Maximization function Objective ) ....... , x ( f = Z Max o Min 2 1 n x x r Subject to (s. t.) Constraint . . , , ) ....... , x ( g . . ) ....... , x ( g ) ....... , x ( g 2 1 2 1 n 2 1 2 2 1 1 n n n n b b b x x x x x x Types of Mathematical Programming: (1) Linear programming (2) nonlinear programming nonlinear programming) : ( Example 1 3 : subject to function Objective x = z M in 2 2 1 2 2 1 x x x x

Transcript of البرمجة الخطية أو البرمجة الرياضية...ÿ The table shows data problem:...

1

Mathematical Programming

:Introduction

الهدف دالة تسمى محدده لدالة الصغرى أو القيمة العظمى القيمة تحديد في يبحث الذي العلم بأنها تعرف الرياضية البرمجة

((Objective function.

البالستيك صناعة .٢ .الكيميائية المفاعالت تصميم .1: الرياضية تطبيقات البرمجة

.واإلنتاج النقل مسائل .٥والجسور المباني تصميم . 4الطائرات اتكمحر تصميم. 3

(الخطية غير العادية التفاضلية المعادالت) العددي التحليل في الرياضية للبرمجة استخدامات وهناك

: programming mathematical forThe general formula

Minimization or Maximization

function Objective)......., x( f =ZMax oMin 21 nxxr

Subject to (s. t.)

Constraint

.

.,,

).......,x (g

.

.

).......,x (g

).......,x (g

2

1

21n

212

211

nn

n

n

b

b

b

xx

xx

xx

Types of Mathematical Programming:

(1) Linear programming

(2) nonlinear programming

nonlinear programming) : ( Example

1

3:subject to

function Objective x=zMin

2

21

2

2

1

x

xx

x

٢

(LP) Linear Programming

Introduction

من األساليب األساسية والمهمة التي تساعد وهي ,تعتبر البرمجة الخطية من أكبر إنجازات منتصف القرن العشرين

وتعد مسائل البرمجة البرمجة الرياضية أساليباحد متخذي القرار على اتخاذ قرارات صحيحة وبطريقة علمية، وهي

؛ ثم إن ( Non-linear) خطيةغيرالمنها و Linear) ( طيةالخطية جزءاً من مسائل البرمجة الرياضية التي تشمل الخ

التي تتعلق جميعها بمسائل التنظيم شمولية، يسمى ببحوث العمليات، البرمجة الرياضية هي بدورها جزء من موضوع أكثر

.واإلدارة ومسائل النقل والزراعة والصناعة

هدف تعظيم الربح وذلك ب، ةالمثل في استخدام الموارد المتاحرياضي يساعد في التخطيط واتخاذ القرار ا كما أنها أسلوب

وفرت الماليين من األموال ومن ساعات قدو،وهي من النماذج المؤكدة وليست من النماذج االحتمالية .او خفض التكلفة

العمـل للعديد من الشركات والمنشآت اإلنتاجية

إلى وضع المشكلة بصيغة رياضية او نموذج رياضي وحلها ترادف في معناها كلمة تخطيط كما تشير :وكلمة برمجة

.باالعتماد على العالقات الخطية

First : Definition of a Linear Program

A function ),....,( 21 nXXXf of ( nXXX ,...., 21 ) is a linear function if

and only if for some set of constants ( nCCC ,...., 21 )

),....,( 21 nXXXf = nn XCXCXC ,....2211

:Optimization problem Second :

It is a mathematical technique for optimum allocation of Limited or scarce

resources, such as labor, material, machine, money energy ….etc

To achieve a specific objective ( maximize or minimize value of the objective

function)

Third: Steps linear programming:

(A) Identify the problem

(B) Construction of mathematical model

(C) Find a solution

Fourth: The general formula for linear programming model:

Linear Programming is concerned with solving just one mathematical

problem, namely maximizing or minimizing a linear function of n variables

(called the objective function) subject to m linear constraints, that is

:(Objective function)(1)

Maximize or Minimize

Max or Min nnxcxcxcxcz 332211

(x1 , x2 , x3 , ……………. , xn) decision variables)

(2) Constraint:

3

Subject to

mnnmmmm

nn

nn

nn

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

),,(

).....,,(.......................................................

),,(

) ,,(

) ,,(

,33,22,11,

3,333,322,311,3

2,233,222,211,2

1,133,122,111,1

(3) Nonnegative:

X1 , X2 , X3 , …………………. , Xn ≥ 0

In matrix terms a linear programming model is:-

MinimizeorMaximize xcz T Subject to

bxA

, 0x

Where A is an nm matrix

nmmm

n

n

n

aaa

aaa

aaa

aaa

A

,2,1,

,32,31,3

,22,21,2

,12,111

mb

b

b

b

b

3

2

1

,

nx

x

x

x

x

3

2

1

and

nc

c

c

c

c

3

2

1

Where:

Z: represents the value of the objective function.

C: the objective function coefficients (profit or cost.).

X: the decision variables.

a: the needs of each and every one unit of resources, whether raw materials,

n: number of variables.

m: the number of restrictions.

b: the resources available .

4

:ProblemMaximization (1)

Max Z = c1X1 + c2X2 + c3X3 + ………+ cnXn

(2) Restrictions

Subject to

mnnmmmm

nn

nn

nn

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

)..........(..................................................

,33,22,11,

3,333,322,311,3

2,233,222,211,2

1,133,122,111,1

X1 , X2 , X3 , …………………. , Xn ≥ 0

Minimization Problem :(2)

Note :

maximum Z = minimum (- Z), the objective function becomes

Min Z = c1X1 + c2X2 + c3X3 + ………+ cnXn

S.t

mnmmmm

nn

nn

nn

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

bxaxaxaxa

..........................................................

,33,22,11,

3,333,322,311,3

2,233,222,211,2

1,133,122,111,1

X1 , X2 , X3 , …………………. , Xn ≥ 0

Fifth: Examples on the formulation of a linear programming problem:

No. 1Example

The company Othazqo manufactures (chairs and tables), the price of the chair $

10, and needs to be one working hour in the Publishing Section, and one

working hour in the collection Section, the price of the table $ 40, and you need

to hours worked in the Publishing Section, and five hours of work in collection

Section, the market accommodates both producers, the time available to work

100 hours in the publishing Section, and 150 hours of work in the collection

Section, Director of the company needs to determine a production mix of chairs

and tables, whose company achieves the maximizing profit.

٥

Solution

The objective here is Maximizing profit Objective First

number of chairs is X1

number of tables is X2

Codes Secondly

The table shows data problem:

Available Time tables X2 chairs X1 Resources

100 2 1 Publishing Section

150 5 1 Collection Section

40 10 price

Put the data in the table above in the form of inequalities, as follows:

Max Z=$10X1+$40X2 Objective function

1X1+2X2 ≤100

1X1+5X2 ≤ 150 Constraints

X1≥ 0,X2 ≥ 0 Non negative

2:No.Example

The company general industrial production of two types of notebooks school

(writing, drawing), the time available(24 hours of the machine, 16 hours of

work), you need each unit produced books( write to 2 of the machine, and 2 of

the work) , while the needs of each unit of the books of (the drawing to 3 hours

of the machine and 1 hour of work). The price of each unit of writing books, $

12, and books drawing $ 14, note that the company could sell only 7 units from

writing books and 6 units of drawing. . Director of the company wants to

determine the quantity of production of two types that achieve the company's

the maximizing profit.

Solution

The objective here is Maximizing profit Objective First

number of writing books is X1

number of drawing books is X2

Codes Secondly

6

The table shows data problem:

Available drawing X2 writing X1 Resources

24 3 2 machine

16 1 2 work

7 - 1 1 market

6 1 - 1 market

14 12 price

Put the data in the table above in the form of inequalities, as follows:

:3No.Example

Wants Dean of the Faculty of Administrative Sciences at the University of

Salman bin Abdul Aziz, develop a plan for number of materials for the next

course. Where the number of materials Section morning and evening section

must be at least 60 articles, and the number of products that must be provided to

the students of the Department Morning at least 30 articles, while the evening

materials section at least 20 articles. Dean also wants to reduce costs to a

minimum. If you know that the cost of material per Section Morning SR 1000

. And the cost of material per Section 800 rails evening. What is the number of

materials Section morning and evening section that you must put Dean in order

to be at a minimum cost?

Solution

The objective here is Minimize costs Objective First

number of materials for morning department is X1

number of materials for the evening department X2

Codes Secondly

: So the mathematical model will be as follows

Max Z =$12 x1+$14 x2

Subject to:

2 x1 +3 x2 ≤ 24

2 x1+ 1 x2 ≤ 16

x1 ≤ 7

x2 ≤6

x1≥ 0 x2≥ 0

7

Min (Z)= 1000 X1 + 800 X2

Subject to:

X1+ X2 ≥ 60

X1 ≥ 30

X2 ≥ 20

X1 , X2 ≥ 0 Non-negative

:Exercises

(1) Industrial company wants to determine the quantities that should be

produced from 3 different products and then limited resources (in the

following table) to maximize profit:

Available 3 Product 3 Product 2 Product 1 Resources

240 4 2 5 Workers

400 3 6 4 Raw materials

2 5 3 Profit

(2) Company produces electric tools three products A, B, and C, and the

company estimated profit for each unit are as follows 150, 120, 90,

respectively., And pass products in three steps a manufacturing, collection and

testing of quality, the following table shows the number of hours needed to

produce one unit of these products, Put the previous problem in the general

form of the linear programming?

quality collection manufacturing Produces

1 3 2 A

0.75 2 3 B

0.75 2 4 C

200 370 450 Time available

8

2:No. Example: Canonical Form Sixth

Optimal solution))قبل البدء باستخدام أي طريقة من طرق الحل للوصول إلى الحل األمثل

:ياسي و سوف نبدأ بالشكل القانوني كاآلتيفان المشكلة يجب أن تكون بأحد الشكلين القانوني أو الق

( (≤ ) جميع القيود من نوع اصغر أو يساوي ( Maxدالة الهدف من نوع -1

( ( ≤)جميع القيود من نوع اصغر أو يساوي ( Minنوع دالة الهدف من -٢

( Xj ≥ 0 ) جميع متغيرات القرار موجبة -3

Standard form Seventh :

تعتبر هذه الصيغة أفضل من السابقة ألنها تستخدم في الطريقة العامة المعتمدة في تحليل البرامج

:غةو أهم خصائص هذه الصي (simplex method)الخطية

Minاو Maxدالة الهدف من نوع -1

bi ≥ 0الجانب األيمن للقيود كمية موجبة -٢

.جميع القيود يعبر عنها بمعادالت ما عدا قيود عدم السالبية -3

Xj ≥ 0جميع المتغيرات تكون موجبة -4

في هذا الشكل يجب تغير جميع القيود التي تكون على شكل متباينات إلى شكل معادالت مساواة و ذلك

:جمع أو طرح متغير غير سالب من الجهة اليسرى لجميع القيود و كما يليطريق عن

اصغر أو يساوي فيتم إضافة المتغير الموجب إلى الجانب األيسر ( ≤ ) إذا كان القيد من نوع - أ

و هو يمثل النقص في الجانب األيسر للقيد Slake Variableمن القيد و يسمى بالمتغير الراكد

.ما هو متوفر للجانب األيمن مقارنة ب

112121111212111 bsxaxabxaxa

اكبر او يساوي يتم طرح المتغير الموجب من الجانب االيسر و ( ≥ ) اذا كان القيد من نوع - ب

و هي تمثل الزيادة في الجانب االيسر على Surplus Variableتسمى بالمتغيرات الفائضة

.الجانب االيمن

112121111212111 bsxaxabxaxa

Eighth: The solution to the linear programming problems:

: First: Some terminology solving linear programming problems

(1) Feasible Solution (permissible): X=(X1,X2….Xn )

تحقق كافة القيود الواردة في المسألة

(2) Basic feasible solution (B.F.S):

.يسمى الحل المقبول حل أساسي مقبول إذا كان عدد المتغيرات الموجبة فيه ال يتجاوز عدد القيود

9

(3) Non degenerate B.F.S:

.من المتغيرات الموجبة mيكون الحل األساسي المقبول حال غير مجزاء إذا احتوت بالضبط على

(4) Optimal Solution:

إضافة إلى ذلك يجعل قيمة دالة الهدف في نهايتها العظمي أو ( يحقق كافة القيود أي الذي)هو الحل

.نهايتها الصغرى

Secondly ::Methods to solve a linear programming problem:

Graphical Method (1)

Simplex Method (2)

(3) The Dual Method

GRAPHIC SOLUTION OF LP PROPLEMS

ionIntroduct

تعتبر طريقة الرسم البياني طريقة سهلة وبسيطة وواضحة في معالجة مشاكل البرمجة الخطية خاصة

تلك المشاكل التي ال يزيد فيها عدد المتغيرات عن اثنين والتي تحتوي على عدد بسيط من القيود كما

مشاكل البرمجة تفيد طريقة الرسم البياني كمقدمة لدراسة طرق وأساليب أخرى أكثر تعقيدا في حل

الخطية مثل السمبلكس

And when you follow the graph method, you must follow these steps:

1.Draw the X-axis and Y (the positive part of each)

1.Specify two points for each straight (equation)

2. Drawing lines expressing the equations

3. Determine the feasible ( possibilities) available

x2

the positive part of each

The point of origin

x1 =0=1س x2 =0=2س

x1 x1

11

1.

4.Set point within the area of the feasible available that give the optimal

results (the maximization or minimization)

(1) Example

Find the optimal solution for the following LP model by using graphical:

Objective function Max z=$10X1+$40X

S.t 1X1+2X2 ≤100

1X1+5X2 ≤ 150

Non negative X1≥ 0,X2 ≥ 0

Solution:

(1) Transfer restrictions to equal as follows

The straight first x1+2x2=100

The straight second x1+5x2=150

- determine of two points for each straight :

Straight 1

X1 X2

0 50

100 0

Straight 2

X1 X2

0 30

150 0

11

Can be drawn straight first and the straight second)

(0=x2 ,150 =X1)

(30= x2, 0=x1)

30

20

10

(0,0) 50 100 150

Feasible

region

(0,0)

The point of origin

50

100

(0=x2 ,100 =X1)

Straight 1

100 = 2X2+x1

(50= x2, 0=x1)

x1

x2

50

25

Feasible

region

The joint solution, an area ( A B C D ) shaded

The objective function is tested at these points, ( A B C D )

: (Extreme Points)

Points (C)

Point to the representation of the intersection of the straight 1 and the straight 2.

x1+2x2=100

x1+5x2=150

Previous solving equations using any method (deletion of compensation,

matrices, determinants, etc. or using a calculator)

using a calculator:

x1=200\3=66.67 x2=50\3=16.67

The result ($ Z=$10 x1+$40 x2 X2 X1 Point

1000 10 ×100 +40 ×0 0 100 B

1335 10 ×66.7 +40 ×16.7 16.7 66.7 C

1200 10 ×0 +40 ×30 30 0 D

straight first 100=2X2+X1

X2

X1

C

D

10

150

B

100

1

66.6 50 A

16.6

50

straight second 150=5X2+X1

30

(0 , 0)

13

Example 2

Find the optimal solution for Example (2) (school books and booklets draw)

way the graph

Max Z =$12 x1+$14 x2 Subject to:

2 x1 +3 x2 ≤ 24

2 x1+ 1 x2 ≤ 16

x1 ≤ 7

x2 ≤6

x1≥ 0 x2≥ 0

Solution:

The same steps as in the first example:

The joint solution, an area (Y2 Y3 Y4) shaded

Extreme Points (Y2 Y3 Y4 ) : Find

Straight 2 2x1+x2=16

Straight 3 X1=7

Straight 4

X2=6

Straight 1 2x1+3x2=24

X1 12

8 7 6 4 2 Y0

4

6

8

Y1 Y2

Y3

Y4

16

Y5

Straight 1

12 0

0 تاغعععععععععععععععععع ععععععع

8

X1 X2

24=3X2 +2X1

7

__

X1

X1=7

Straight 3

3لمستقيم

8 0

0 16

X1

X2

16 =X2 +2X1

Straight 2

Straight 4

4لمستقيم

__

6

X2

X2=6

X2

14

Point (Y4) represents the intersection of 2 straight and the 3 straight:

7 x1= 16 2x1+x2=

٢= x2 -14 16 = x2 16 = 2(7) +x2

Point (Y2 ) represents the intersection of 2 straight and the 4straight:

24 2x1+3x2=

x2=6

Use a calculator x1 =3 x2 = 6

Point (Y3) represents the intersection of 1 straight and the 2straight

24 2 x1+ 3x2 =

2 x1+ x2= 16

=4 2 =6 x 1 xUse a calculator

So Max z = $12X1 + $14X2

The result $ Z=$12x1+$14x2 X2 X1 Point

120 12 ×3 +14×6 6 3 Y2

128 12 ×6 +14×4 4 6 Y3

112 12 ×7 +14×2 2 7 Y4

highest return at the point Y3, must produce ( 6 writing books, 4 draw) to

achieve a return of $ 128

Example 2

Find the optimal solution

MMiinn ZZ == 55XX ++ 22YY

0011 >> YY++ 55 XX22 ss..tt..

1122 >> YY -- XX44

44 >> YY++ XX

00 >> YY,, XX Solution:

The same steps as in the first example:

Extreme Points (Y2 Y3 Y4 ) : Find

Point B

,, 44XX -- YY == 1122 XX++ YY == 44

== 44//55 YY== 1166//55 XXUse a calculator

The result $ Z= 55XX ++ 22YY XX Y Point

30 12 ×3 +14×6 6 0 A

1177..66 mmiinn 55((1166//55)) ++ 22((44//55)) 44//55 1166//55 B

The objective function ZZ == 55XX ++ 22YY == 55((1166//55)) ++ 22((44//55)) == 8888//55== 1177..66

We find that the optimal solution is:

XX == 1166//55 YY == 44//55 ZZ == 8888//55

Straight 1

5 0

0 ععععععععععععععععععععع

عععع

2

XX YY

22XX ++ 55YY==1100

3 0

0 -12

XX YY 12 = YY - 4 XX

Straight 2

4 0

0 4

XX YY

XX ++ YY == 44

Straight 3

12 > Y - X4 4 > Y+ X

1100 > Y+ 5 X2

55

44

33

22

11

Y

X

The

solutions

11 22 33 44 55 66

16

:xerciseE

(1) Find a solution following a linear programming problem using the graph

method:

Maximize

Z = 3x + 2y

subject to: 2x + y ≤ 18

2x + 3y ≤ 42

3x + y ≤ 24

x ≥ 0 , y ≥ 0

SX4RERE Coordinates (x,y) Objective value(Z)

C (0,14) 28

G (3,12) 33

H (6,6) 30

F (8,0) 24

(2) Find a solution following a linear programming problem using the graph

method: