Professional Documents
Culture Documents
Greedy Techniques:
* One of the straight forward techniques. * Used for solving optimization problems. Method: Every greedy based problem will be given a set of inputs & constraints. The objective is to find a solution vector , which satisfies set of constraints. The greedy method works in stages. At each stage a decision is made regarding whether/or not a particular i/p is an optimal solution. To know whether an i/p is optimal or not a selection process is used. If the i/p doesnt contribute to an optimal solution , it is not included in partial solution. PES School Of Engineering Dept of MCA Faculty: Dr. Arti Arya
2
(3) A Feasibility Function: that is used to determine if a candidate can be used to contribute to a solution.
(4).An Objective Function: which assigns a value to a solution , or a partial solution.
(5).Solution Function: which will indicate when we discovered complete a complete solution.
Greedy Algorithm:
- They are shortsighted , in their approach , taking decisions on the basis of information available immediately at hand without about the effect , these decisions may have in future .
worrying
Greedy Method Control Abstraction: ALGORITHM Greedy(a,n) // a[1:n] contains n inputs { solution= ; // initialize the solution. This version of greedy for i = 1 to n do { algorithm is Subset paradigm x= Select(a) if feasible(Solution , x) then solution = Union(Solution , x ); } return solution; }
Contd
For problems , that do not call for selection of an optimal subset , in the Greedy method , the decisions by considering the i/p in some order , then this version of Greedy algorithm is called ordering paradigm.