Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computationally speaking, we can partition problems into two categories. Easy Problems and Hard Problems We can say that easy problem ( or in some languages.

Similar presentations


Presentation on theme: "Computationally speaking, we can partition problems into two categories. Easy Problems and Hard Problems We can say that easy problem ( or in some languages."— Presentation transcript:

1 Computationally speaking, we can partition problems into two categories. Easy Problems and Hard Problems We can say that easy problem ( or in some languages polynomial problems or P problems) are those problems with their solution time proportional to n k. Where n is the number of variables in the problem, and k is a constant, say 2, 3, 4 … Let’s assume that k = 2. Therefore, easy problems are those problems with their solution time proportional to n 2. Where n is the number of variables in the problem. Difficult problems (or NP-hard) problems are those problems with their solution time proportional to k n, or in our case 2 n. Computational Complexity

2 Suppose there is a P problem with n variables which is solved in one hour on a personal computer. If the power of the computer is increased by 1000 times, and if we have one century time to solve the problem, then we have the following proportionality n 2 1 x 2 1000×100×365×24  x > 29000n Computational Complexity Under the new technology-time conditions we can solve a problem where the number of variables (the size of the problem) is more than 29,000 times the size of the original problem.

3 Now suppose the problem is NP-hard, therefore, we have the following proportionality 2 n 1 2 x 1000×100×365×24  x = n +29 Computational Complexity Under the new technology-time conditions we can solve a problem with 29 additional variables!

4 Binary Variables

5 1- Exactly one of the two projects is selected 2- At least one of the two projects is selected 3-At most one of the two projects is selected 4- None of the projects should be selected Exactly one, at least one, at most one, none

6 1- Both projects must be selected 2- none, or one or both of projects are selected 3- If project 1 is selected then project 2 must be selected 4- If project 1 is selected then project 2 could not be selected Both, at most 2

7 More Practice

8 Either project 1&2 or projects 3&4&5 are selected More Practice

9 Consider a linear program with the following set of constraints: 12x 1 + 24x 2 + 18x 3 ≤ 2400 15x 1 + 32x 2 + 12x 3 ≤ 1800 20x 1 + 15x 2 + 20x 3 ≤ 2000 18x 1 + 21x 2 + 15x 3 ≥ 1600 Suppose that meeting 3 out of 4 of these constraints is “good enough”. One out of n constraints

10 Go back to crashing problem A Constraint With k Possible Values y 1 + y 2 = 10 or 20 or 100

11 Answers 1- Exactly one of the two projects is selected X1+X2=1 2- At least one of the two projects is selected X1+X2>=1 3-At most one of the two projects is selected X1+X2 =X1 7- If project 1 is selected then project 2 could not be selected This is the same as at most one of the two X1+X2<=1

12 Answers 8- Either project 1&2 or projects 3&4&5 are selected X1=X2 X3=X4=X5 X1+X3<=1 10- y 1 + y 2 = 10 or 20 or 100 y1+y2 = 10 z1+20z2+100z3 z1+z2+z3=1

13 Example 6 3 4 2 5 7 2 6 5 6 4 8 7 2 2 1

14 Decision Variables and Formulation x ij : The decision variable for the directed arc from node i to nod j. x ij = 1 if arc ij is on the shortest route x ij = 0 if arc ij is not on the shortest route  x ij -  x ji = 0  i  N \ O and D  x oj =1  x iD = 1 Min Z =  l ij x ij 6 3 4 2 5 7 2 6 5 6 4 8 7 2 2 1

15 Example 6 3 4 2 5 7 2 6 5 6 4 8 7 2 2 1 + x 13 + x 14 + x 12 = 1 + x 57 + x 67 = 1 + x 35 - x 13 = 0 + x 45 + x 46 - x 14 = 0 …. ….. Min Z = + 5x 12 + 2x 13 + 6x 14 + 6x 26 + 7x 35 + 8x 45 + 4x 46 + 2x 57 + 2x 67

16 Find the Shortest Route 8 3 4 5 7 10 4 3 5 6 4 5 3 2 2 1 2 6 9 11 6 2 4 3 4 6 6 O D 2 3 6 5


Download ppt "Computationally speaking, we can partition problems into two categories. Easy Problems and Hard Problems We can say that easy problem ( or in some languages."

Similar presentations


Ads by Google