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
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 ×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.
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!
Binary Variables
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
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
More Practice
Either project 1&2 or projects 3&4&5 are selected More Practice
Consider a linear program with the following set of constraints: 12x x x 3 ≤ x x x 3 ≤ x x x 3 ≤ x x x 3 ≥ 1600 Suppose that meeting 3 out of 4 of these constraints is “good enough”. One out of n constraints
Go back to crashing problem A Constraint With k Possible Values y 1 + y 2 = 10 or 20 or 100
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
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
Example
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
Example 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 x x x x x x x x 67
Find the Shortest Route O D