Discrete Optimization - Chen, Batson, Dang: Applied ...Outline 1 4.4 Preprocessing Pure 0-1 Integer...
Transcript of Discrete Optimization - Chen, Batson, Dang: Applied ...Outline 1 4.4 Preprocessing Pure 0-1 Integer...
Discrete OptimizationChen, Batson, Dang: Applied integer Programming. Modeling and
SolutionsSections 4.4 to 4.6 and Chapter 5
Lu Li and Japhet Niyobuhungiro
Seminar 3April 7, 2015
()
Outline
1 4.4 Preprocessing Pure 0-1 Integer Programs
2 4.5 Decomposing a Problem into Independent Subproblems
3 4.6 Scaling the Coefficient Matrix
4 5 MODELING COMBINATORIAL OPTIMIZATION PROBLEMS(COP) I
5 5.1 Introduction
6 5.2 Set Covering and Set Partitioning
7 5.3 Matching Problems
8 5.4 Cutting Stoch Problem
9 5.5 Comparisons for Above Problems
10 5.6 Computational Complexity of COP
()
Outline
Important classes of COP appearing in Chapters 1&2 and Chapters 6&10
Chapter 5: Discuss modeling and successful real-worls applications ofsome COPs:
set covering
set partitioning
node covering
set packing
matching
cutting stock
()
Outline
Important classes of COP appearing in Chapters 1&2 and Chapters 6&10Chapter 5: Discuss modeling and successful real-worls applications ofsome COPs:
set covering
set partitioning
node covering
set packing
matching
cutting stock
()
Definition
The COP is a class of optimization problem whose optimum solution(s)can be identified from a finite set of feasible solutions
which can (in principle) be obtained by complete enumeration of allpossible combinations.
IP formulations of some COPS (Chapter 2)
The 0-1 knapsack problem (Section 2.3.1)
The capital budgeting problem (Section 2.3.2)
The uncapacitated lot sizing problem (Section 2.4.1)
The workforce/staff scheduling problem (Section 2.5)
The uncapacitated facility location problem (Section 2.6.2).
()
Another group of COPs: the network optimization problems
The minimum cost network flow problem (Section 10.2.1).
The assignment problem (Section 10.2.2, also Section 6.2)
The transportation problem (Section 10.2.2)
The transshipment problem (Section 10.2.3)
The maximal flow problem (Section 10.2.4)
The shortest path problem (Section 10.2.5)
can be solved as if they were linear programs (by ignoring integerrequirements) because their constraint matrices are totally unimodular.
Remark
Any pure IP problem with bounded variables, general or binary, can betreated as a COP!.
()
Another group of COPs: the network optimization problems
The minimum cost network flow problem (Section 10.2.1).
The assignment problem (Section 10.2.2, also Section 6.2)
The transportation problem (Section 10.2.2)
The transshipment problem (Section 10.2.3)
The maximal flow problem (Section 10.2.4)
The shortest path problem (Section 10.2.5)
can be solved as if they were linear programs (by ignoring integerrequirements) because their constraint matrices are totally unimodular.
Remark
Any pure IP problem with bounded variables, general or binary, can betreated as a COP!.
()
Another group of COPs: the network optimization problems
The minimum cost network flow problem (Section 10.2.1).
The assignment problem (Section 10.2.2, also Section 6.2)
The transportation problem (Section 10.2.2)
The transshipment problem (Section 10.2.3)
The maximal flow problem (Section 10.2.4)
The shortest path problem (Section 10.2.5)
can be solved as if they were linear programs (by ignoring integerrequirements) because their constraint matrices are totally unimodular.
Remark
Any pure IP problem with bounded variables, general or binary, can betreated as a COP!.
()
Set covering problem
Given
a set of requirements or characteristics (say R) that must be satisfiedentirely,
a set of activities (say A1, A2, . . ., An) whose union equals or ”cover”R, and a cost associated with each activity.
A feasible solution is defined as a select subset of activities that as awhole can satisfy all requirementsAn optimal solution is a feasible solution with a minimal total cost
Set covering problem
Determine a combination of activities Aj ’s that can collectively cover Rwhile minimizing a certain objective function.
()
Set covering problem examples
An airline company has a set of scheduled flights (set of requirements) tobe covered entirely and has a set of crews (set of activities) available forflight assignments
Assuming each crew (activity) incurs a certain cost
the objective is to find a subset of crews that cover all flights andminimize the total cost of crew assignments.
R= {1, 2, 3, 4, 5}and
A1 = {1, 2, 5}, A2 = {3, 4}, A3 = {3, 4, 5}, A4 = {2, 4, 5}
The selections {A1,A2} and {A1,A3} cover R becauseR= A1 ∪ A2 = A1 ∪ A3.The selections {A1,A4}, {A2,A3}, and {A3,A4} do not.
()
5.2.1 Set covering problem
Many real-world problems have been modeled as the set covering and setpartitioning problems, primarily in industries such as airlines, trucking,communication, hospitals, and manufacturing. Primary applicationareas include flight crew scheduling, facility location, truck/vehicledelivery and routing, and workforce scheduling.
two examples
Example 5.1 (Location of Warehouses)
Example 5.2 (Flight Crew Scheduling Problem)
to show how to formulate a set covering problem
1st step: identification of the sets of requirements and activities.
()
Example 5.1 (Location of Warehouses)
A firm has five distribution centers and it is to be determined as to which subset ofthese distribution centers should be selected as a site for construction of warehouses.Suppose the goal is to build a minimal number of warehouses that can cover alldistribution centers in a manner that every warehouse is located within 10 miles of eachdistribution center it services
()
Example 5.1 (Location of Warehouses)(cont.)
formulation as a set covering problem, a special 0-1 IP model.
Step 1.
Input parameters: number of distribution centers (m), vectors ofactivity (aj ,j = 1, 2, . . . , n), requirement vector (b = 1)Decision variables: whether or not to build a warehouse at the ithdistribution center (yi= 1 or 0, i = 1 : 5)Constraint: each of the five distribution centers must be coveredObjective: minimize the number of warehouses built
Step 2. Let yi = 1 if a warehouse is built at center i and 0 otherwise.To ensure at least one warehouse is within 10 miles of center 1, wehave constraint
y1 + y2 ≥ 1 (requirement 1 constraint)
()
Example 5.1 (Location of Warehouses)(cont.)
formulation as a set covering problem, a special 0-1 IP model.
()
Example 5.1 (Location of Warehouses)(cont.)
formulation as a set covering problem, a special 0-1 IP model.
()
Example 5.2 (Flight Crew Scheduling Problem)
Example
American Airlines has over 8000 airplanes and 16,000 flight attendants toschedule. They estimate that their mathematical programming-based system (inwhich the covering problem is a major component) saves about $20 million peryear (see Table 1.1 from the book!).
Many MIP applications in the airline industry involve crew scheduling.
The problem can be formulated as a set covering problem as follows:
(1) List the set of flight legs that are required to be covered
(2) Generate a set of flight sequences or tours that begin and end in the samecity, subject to certain regulations and conditions
(3) Formulate a 0-1 integer program to find a subset of flight sequences thatcover all flights at a minimal cost
()
Example 5.2 (Flight Crew Scheduling Problem)(cont.)
Numerical example
Budget Airways is required to assign its crews based in New York to coverall the upcoming scheduled flights. There are many possible sequences offlights that are feasible for a crew to choose from, assuming one crew canonly be assigned to one sequence. In Table 5.3, 10 flights and 8 feasiblesequences of flights are viewed respectively as requirements and activitiesof the set covering problem. The associated cost of each sequence of flightis also listed in this table. The problem is to find crew assignment thatcovers all 10 flights at a minimal total cost.
()
Example 5.2 (Flight Crew Scheduling Problem)(cont.)
()
Example 5.2 (Flight Crew Scheduling Problem)(cont.)
Form a node-arc incidence matrix A, having an entry of ”1” if a sequenceof flights covers a certain flight and ”0” otherwise
()
Example 5.2 (Flight Crew Scheduling Problem)(cont.)
Formulation as a set covering problem.
Step 1.
Input parameters: 0-1 incidence matrix (A) given in Table 5.4, costfor each feasible sequence of flight (cj ,j = 1, 2, . . . , 8), requirementvector (bi = 1, i = 1, 2, . . . , 10)Decision variables: one 0-1 variable for each sequence of flight(yj = 1 or 0, j = 1, 2, . . . , 8)Constraint: one constraint for each requirement or flightObjective: minimize the total cost of assigning crews to the selectedsequence of flights
Step 2. Let yj = 1 if a crew is assigned to the jth sequence of flights and 0 otherwise. Toensure that at least one crew is assigned to the first flight, we have constraint
y1 + y4 + y7 ≥ 1 (requirement 1 constraint)
()
Example 5.2 (Flight Crew Scheduling Problem)(cont.)
The 0-1 IP model:
()
Set covering-General formulation
min z = cTys. t. Ay ≥ 1
y ∈ (0, 1)
where
c is a cost vector representing the costs associated with activities
y is a vector of 0-1 variables indicating whether the correspondingactivity is chosen or not
A is a 0-1 matrix representing relationships between requirements andactivities.
()
5.2.2 Set Partitioning and Set Packing
The set partitioning problem is the same as the set covering problem except that eachrequirement must be exactly satisfied.
min z = cTys. t. Ay = 1
y ∈ (0, 1)
Example: Consider the problem of delivering orders from a warehouse to n differentstores by m trucks
Each store receives its order in exactly one delivery
A truck can deliver at most k(k < n) orders (stores)
Requirements: all orders (stores) must be delivered
Activity j: represents a feasible delivery sequence of orders satisfying the truckcapacity.
The collection of feasible activities forms a matrix A
The constraint set, Ay = 1, ensures that every order is delivered exactly by onetruck
()
Set Packing
Set Packing
In a busy day, it may be acceptable that some lower priority orders can bepostponed to a later day. To represent this situation, the set of constraintsbecomes
Ay ≤ 1
This problem is known as a set packing problem.
()
5.2.3 Set Covering in Networks
In the domain of an undirected network, the set covering problem can beposed as a node covering problem.
Consider an undirected network G(V,E) of n = |V| nodes and m = |E|arcs, each arc joining a pair of nodes.
A cover is a subset of arcs such that each of the n nodes is incident orconnected to at least one arc of the subset.
A simple covering problem is defined as finding a cover with a minimumnumber of arcs.
()
5.2.3 Set Covering in Networks
In the domain of an undirected network, the set covering problem can beposed as a node covering problem.Consider an undirected network G(V,E) of n = |V| nodes and m = |E|arcs, each arc joining a pair of nodes.
A cover is a subset of arcs such that each of the n nodes is incident orconnected to at least one arc of the subset.
A simple covering problem is defined as finding a cover with a minimumnumber of arcs.
()
n = 7 and m = 12
This is a cover, but not minimal! e.g. arc (4, 5) can be dropped
()
constructing a node-arc incidence matrix of the network. i = node andj = arc. Column vector aj joins nodes p and q such that apj = aqj = 1 andaij = 0 if i 6= p, q.
()
Let variable yj be 1 if the jth arc is selected and 0 otherwise
()
General node covering problem
where
cT is a row vector containing m elements of 1’s
y= (y1, y2, . . . , ym)T
1= (1, 1, . . . , 1)T
A is an n ×m matrix
Remark: The node covering problem defined on an undirected network is a special case of theset covering problem
()
General node covering problem
where
cT is a row vector containing m elements of 1’s
y= (y1, y2, . . . , ym)T
1= (1, 1, . . . , 1)T
A is an n ×m matrix
Remark: The node covering problem defined on an undirected network is a special case of theset covering problem
()
5.2.4 Applications of Set Covering Problem
Can be classified in three major areas:
1 facility location
2 scheduling or staffing of personnel
3 dispatching trucks/vehicles to routes/customers
()
Matching Problems
The matching problem belongs to another class of combinatorialoptimization problems in which the constraint matrix A has exactlytwo 1’s in each column
They deal with matching, pairing, or grouping objects such asselecting roommates, matching males to females, and assigning jobsto workers
The primary applications of this problem are for the development ofmatching-based algorithms
modeling network flowroutingschedulingspanning treeportfolio hedging and tracking
()
5.3.1 Matching Problems in Network
Consider an undirected network G(V,E) of n = |V| nodes and m = |E|arcs, each arc joining a pair of nodes.
The number of arcs incident to node i is called the degree of node i
The matching problem is to find a subset of arcs in the network suchthat at least a certain number of degrees, say bi are connected to nodei , where bi is a positive integerThis problem is called the b-matching problem, where bi is an elementof b
1-matching problem
Find a matching in which each node can only be connected by at most onearc.
bi = 1 for all i
()
5.3.1 Matching Problems in Network (Cont.)
i. Consider the undirected network
The subset of arcs {(1, 2), (3, 4), and (5, 6)} is a 1-matching
()
5.3.1 Matching Problems in Network (Cont.)
The 1-matching problem can be formulated as a 0-1 integer programA commonly used objective is to maximize the number of arcs selected
where
aij is an element of a node-arc incidence matrix of the network
yj = 1 if the jth arc is included in the matching, and 0 otherwise
()
5.3.1 Matching Problems in Network (Cont.)
The 1-matching problem vs the node covering problem,mathematically
1 The objective function is replaced by maximization
2 the constraint set is replaced by ≤ inequalities
The node covering problem seeks to minimize the number of arcs used tocover all nodes in the network, while the 1-matching problem seeks tomaximize the number of arcs to connect nodes subject to at most one arccan be incident to each node
()
5.3.2 Integer Programming Formulation
The b-matching problem is a generalization of the the 1-matching problem which can beformulated as a 0-1 IP model:
where
c= (1, 1, . . . , 1)T is a row vector containing m elements of 1’s
y= (y1, y2, . . . , ym)T
b= (b1, b2, . . . , bn)
A is an n ×m matrix node-arc incident matrix with each column containingexactly two elements of 1’s
()
Note on the matching problem
The matching problem can be a maximization or minimizationproblem
find a maximum number of matching in the roommate selectionproblemfind a minimum number of arcs forming a closed route in the postmanproblem
When c is a vector of weights associated with variables, instead of1’s, the problem is called a weighted b-matching
When the constraint set is Ay = 1, as in the set partitioning problem,the problem is called a weighted perfect matching. if the pairingobjects are selected from two disjoint sets, then it becomes the classicalassignment problem
assigning a set of workers (machines) to a set of jobsassigning a set of plants to a set of potential locationsassigning a set of tasks to a set of time slots
ref. bipartite network
()
5.4.1 1D Cutting Stock ProblemA possible cutting pattern from a roll of width W, which includes two rolls of width w1, one roll of w2, and one roll of trim lossT.
If W = 12 ft, w1 = 3 ft and w2 = 5 ft, then there are seven possible cutting patterns (4-7 are not feasible, T ≥ 3)
()
5.4.1 1D Cutting Stock ProblemA possible cutting pattern from a roll of width W, which includes two rolls of width w1, one roll of w2, and one roll of trim lossT.
If W = 12 ft, w1 = 3 ft and w2 = 5 ft, then there are seven possible cutting patterns (4-7 are not feasible, T ≥ 3)
()
5.4.1 1D Cutting Stock Problem (Cont.)
Assume that there are available a sufficiently large number of rolls of asingle standard width W, all having the same length L, that can be cutinto at least bi pieces of the ordered widths wi (i = 1, 2, . . . ,m).
one-dimensional cutting stock problem
Determine how to cut rolls of the standard width into various orderedwidths so that the required number of rolls (assuming trim pieces areuseless) is minimal while satisfying the ordered quantity bi of each widthwi.
()
5.4.1 1D Cutting Stock Problem (Cont.)
If W = 12 ft, w1 = 3 ft and w2 = 5 ft, then there are seven possible cutting patterns (4-7 arenot feasible, T ≥ 3)
()
Modeling 1D Cutting Stock Problem
Let vector aj denote the jth cutting pattern, whose component aijdenotes the number of pieces in width wi , that can be generated from astandard width W.
aj =
a1j...aij...
amj
, aij ≥ 0; Tj = W −m∑i=1
wiaij ≥ 0
where Tj ≤ minwi is the trim loss associated with the jth cuttingpattern.
()
Modeling 1D Cutting Stock Problem(cont.)
Step 1.
Input parameters: standard width (W), ordered widths(wi , i = 1, 2, . . . ,m), required number of rolls of ordered widths(bi , i = 1, 2, . . . ,m), all cutting patterns to be used (aj , j = 1, 2, . . . , n)Decision variables: number of standard rolls (yj , Tj) to be cutaccording to the jth patternConstraint: total number of each ordered width wi , made must be atleast biObjective: minimize the number of standard rolls needed
Step 2. The given cutting stock problem becomes
If cost cj is incurred with aj , then Minimize∑n
j=1 cjyj .
()
one-dimensional problem with multiple standard widths(W k , k = 1, 2, . . . ,K ) with a fixed length L. For each standard width W k ,let nk be the number of patterns, ykj be the number of the jth pattern to
be cut, and ckj be the associated cost of cutting each jth pattern. Then the
jth pattern can be represented by a vector akj , whose ith component is akij .
akij ≥ 0; T kj = W k −
m∑i=1
wiakij ≥ 0
()
one-dimensional problem with multiple standard widths(W k , k = 1, 2, . . . ,K ) with a fixed length L. For each standard width W k ,let nk be the number of patterns, ykj be the number of the jth pattern to
be cut, and ckj be the associated cost of cutting each jth pattern. Then the
jth pattern can be represented by a vector akj , whose ith component is akij .
akij ≥ 0; T kj = W k −
m∑i=1
wiakij ≥ 0
()
5.4.2 Two-Dimensional Cutting Stock Problem
A two-dimensional cutting stock problem allows both horizontal and vertical cuts to getthe ordered sizes
2D cutting stock problemRolls of standard width W and length L can be cut into bi number of rectangular piecesof size wi × `i (i = 1, 2, . . . ,m). Let aij be the number of rect. pieces of sizes wi × `i
generated by the jth cutting pattern.
Example: Given rolls of W = 4 ft and L = 10 ft and demand of five rect. pieces of2 ft × 4 ft and three of 3 ft × 7 ftExamples of two-dimensional cutting patterns:
a1 =
(11
)a2 =
(50
)
()
5.4.2 Two-Dimensional Cutting Stock Problem
A two-dimensional cutting stock problem allows both horizontal and vertical cuts to getthe ordered sizes
2D cutting stock problemRolls of standard width W and length L can be cut into bi number of rectangular piecesof size wi × `i (i = 1, 2, . . . ,m). Let aij be the number of rect. pieces of sizes wi × `i
generated by the jth cutting pattern.
Example: Given rolls of W = 4 ft and L = 10 ft and demand of five rect. pieces of2 ft × 4 ft and three of 3 ft × 7 ftExamples of two-dimensional cutting patterns:
a1 =
(11
)a2 =
(50
)
()
5.4.2 Two-Dimensional Cutting Stock Problem
A two-dimensional cutting stock problem allows both horizontal and vertical cuts to getthe ordered sizes
2D cutting stock problemRolls of standard width W and length L can be cut into bi number of rectangular piecesof size wi × `i (i = 1, 2, . . . ,m). Let aij be the number of rect. pieces of sizes wi × `i
generated by the jth cutting pattern.
Example: Given rolls of W = 4 ft and L = 10 ft and demand of five rect. pieces of2 ft × 4 ft and three of 3 ft × 7 ftExamples of two-dimensional cutting patterns:
a1 =
(11
)a2 =
(50
)
()
5.4.2 Two-Dimensional Cutting Stock Problem
A two-dimensional cutting stock problem allows both horizontal and vertical cuts to getthe ordered sizes
2D cutting stock problemRolls of standard width W and length L can be cut into bi number of rectangular piecesof size wi × `i (i = 1, 2, . . . ,m). Let aij be the number of rect. pieces of sizes wi × `i
generated by the jth cutting pattern.
Example: Given rolls of W = 4 ft and L = 10 ft and demand of five rect. pieces of2 ft × 4 ft and three of 3 ft × 7 ftExamples of two-dimensional cutting patterns:
a1 =
(11
)
a2 =
(50
)
()
5.4.2 Two-Dimensional Cutting Stock Problem
A two-dimensional cutting stock problem allows both horizontal and vertical cuts to getthe ordered sizes
2D cutting stock problemRolls of standard width W and length L can be cut into bi number of rectangular piecesof size wi × `i (i = 1, 2, . . . ,m). Let aij be the number of rect. pieces of sizes wi × `i
generated by the jth cutting pattern.
Example: Given rolls of W = 4 ft and L = 10 ft and demand of five rect. pieces of2 ft × 4 ft and three of 3 ft × 7 ftExamples of two-dimensional cutting patterns:
a1 =
(11
)a2 =
(50
)()
COPs described in this chapter
Find an integer vector y
Such that objective function z = cTy is minimized or maximized
Subject to a set of equality or inequality constraints: Ay {> or = or <} b
()
COPs described in this chapter
Find an integer vector y
Such that objective function z = cTy is minimized or maximized
Subject to a set of equality or inequality constraints: Ay {> or = or <} b
()
Computational Complexity of COP
Solving a COP problem can be algorithmically simple but computationallyintractable.
Consider the knapsack problem
The number of all possible feasible solutions
Cn1 + Cn
2 + . . . + Cnn−1 + Cn
n = 2n − 1
Roughly, each additional 10 items will take nearly 1000-fold ofadditional computer time
suppose we have a computer that could calculate an arithmeticoperation at a speed of light, that is, it can perform 8 trillionarithmetic operations per second. The complete enumerationalgorithm would take over 4 years to solve a 70 item knapsackproblem and would take over 4000 years to solve an 80 item problem
()
5.6.1 Problem vs Problem Instance
problem
a class of problems having a common set of characteristics.
For example, the knapsack problem is defined as a class of problems thatis to determine an optimal subset of items within a prescribed knapsackcapacity.The set covering problem is another class of problems that is to determinean optimal combination of activities covering all the prescribedrequirements.
problem
In general, a problem is defined in terms of the types of its goal (min ormax), decision variables, and constraintsTo solve a particular COP problem, parameters such as c, A, b, m, and nmust be specified. A problem, after specification of its parameters, iscalled a problem instance
()
5.6.1 Problem vs Problem Instance
problem
a class of problems having a common set of characteristics.For example, the knapsack problem is defined as a class of problems thatis to determine an optimal subset of items within a prescribed knapsackcapacity.
The set covering problem is another class of problems that is to determinean optimal combination of activities covering all the prescribedrequirements.
problem
In general, a problem is defined in terms of the types of its goal (min ormax), decision variables, and constraintsTo solve a particular COP problem, parameters such as c, A, b, m, and nmust be specified. A problem, after specification of its parameters, iscalled a problem instance
()
5.6.1 Problem vs Problem Instance
problem
a class of problems having a common set of characteristics.For example, the knapsack problem is defined as a class of problems thatis to determine an optimal subset of items within a prescribed knapsackcapacity.The set covering problem is another class of problems that is to determinean optimal combination of activities covering all the prescribedrequirements.
problem
In general, a problem is defined in terms of the types of its goal (min ormax), decision variables, and constraintsTo solve a particular COP problem, parameters such as c, A, b, m, and nmust be specified. A problem, after specification of its parameters, iscalled a problem instance
()
5.6.1 Problem vs Problem Instance
problem
a class of problems having a common set of characteristics.For example, the knapsack problem is defined as a class of problems thatis to determine an optimal subset of items within a prescribed knapsackcapacity.The set covering problem is another class of problems that is to determinean optimal combination of activities covering all the prescribedrequirements.
problem
In general, a problem is defined in terms of the types of its goal (min ormax), decision variables, and constraints
To solve a particular COP problem, parameters such as c, A, b, m, and nmust be specified. A problem, after specification of its parameters, iscalled a problem instance
()
5.6.1 Problem vs Problem Instance
problem
a class of problems having a common set of characteristics.For example, the knapsack problem is defined as a class of problems thatis to determine an optimal subset of items within a prescribed knapsackcapacity.The set covering problem is another class of problems that is to determinean optimal combination of activities covering all the prescribedrequirements.
problem
In general, a problem is defined in terms of the types of its goal (min ormax), decision variables, and constraintsTo solve a particular COP problem, parameters such as c, A, b, m, and nmust be specified. A problem, after specification of its parameters, iscalled a problem instance
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.
e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.
Note: provides an upper bound on how poor an algorithm could be.
()
5.6.2 Computational Complexity of an Algorithm
Computational Complexity of an Algorithm
Mathematical function is often used to describe the growth ofcomputational effort as problem size increases.e.g., the complete enumeration for the knapsack problem of size n has acomputational complexity of 2n
the big O notation
to express an approximate upper bound computational effort for a givenalgorithm to solve a problem instance of size n.
g(n) = O(f (n)),
means ∃C > 0, n0 ∈ N | g(n) ≤ C · f (n), ∀n ≥ n0
e.g., If g(n) = an + b then g(n) = O(n) for all n ≥ 1.Note: provides an upper bound on how poor an algorithm could be.
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.
If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem. If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem. If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem.
If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem. If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem. If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
5.6.3 Polynomial vs Nonpolynomial Function
When the function is polynomial, the algorithm is said to be of polynomial complexity (orto be polynomially bounded) and such a polynomial algorithm is considered to be ”easy”or efficient.If g(n) = 6n2 + 15n + 40, then O(f (n)) = O(n2).
Conversely, a nonpolynomial function is considered to be ”hard” because the algorithm iscapable of solving only a very small problem. If g(n) = 2n−1 + n2 + 10, thenO(f (n)) = O(2n−1) ∼= O(2n).
()
The End
()