• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Search and Optimization Strategies
 

Search and Optimization Strategies

on

  • 523 views

Search and Optimization Strategies ...

Search and Optimization Strategies

Topics:
Definitions
Branch & Bound
Greedy
Local Search

Teaching material for the course of "Tecniche di Programmazione" at Politecnico di Torino in year 2012/2013. More information: http://bit.ly/tecn-progr

Statistics

Views

Total Views
523
Views on SlideShare
523
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Search and Optimization Strategies Search and Optimization Strategies Presentation Transcript

    • Search and Optimization StrategiesTecniche di Programmazione – A.A. 2012/2013
    • SummaryA.A. 2012/2013Tecniche di programmazione2 Definitions Branch & Bound Greedy Local Search
    • DefinitionsSearch and Optimization Strategies
    • Search vs OptimizationA.A. 2012/2013Tecniche di programmazione4 A search algorithm is an algorithm for finding an itemwith specified properties among a collection of items Specified properties: usually “local” properties, defined by some“feasibility” criteria Collection: explicit, or virtual (implicit) An optimization algorithm aims ad finding the bestpossible solution, according to an objective function,among all possible feasible solutions for a givenproblem
    • Objective functionA.A. 2012/2013Tecniche di programmazione5 Must be computable for all feasible solutions May be undefined for unfeasible (or incomplete) solutions Maximization problems Objective function = value, goodness Must find the maximum value of objective function Minimization problems Objective function = cost Must find the minimum value of objective function
    • A.A. 2012/2013Tecniche di programmazione6Types of problems Search problems: is there (at least one) feasible solution? Ex: magical square Ex: Hamiltonian cycle Optimization problems: what is the best solution? In these problems finding feasible solutions is usually easy Ex: Hamiltonian cycle on a complete graph (Hamiltonan bee) Hybrid problems (search + optimization): are there any validsolutions? And what is the best? Ex: travelling salesman problem
    • A.A. 2012/2013Tecniche di programmazione7RepresentationS: SolutionsV:Valid (feasible) solutionsM: best solutionssssf(s)Objectivefunction
    • A.A. 2012/2013Tecniche di programmazione8Classification Search problems S V |V| = 0 ? Find a s V Optimization problems S =V find max(f(s)) Hybrid problems S V find max(f(s)) such that s V
    • Exact techniquesA.A. 2012/2013Tecniche di programmazione9 Exhaustive generation of all possible solutions Iteratively Recursively Optimizing recursive techniques Visit order Generate non-useless solutions: Branch and Bound Recognize equivalent sub-problems: Dynamic Programming1 23 45 67 8
    • Approximate TecniquesA.A. 2012/2013Tecniche di programmazione10 Greedy Pseudo-random Hill climber123
    • Approximate solutionsA.A. 2012/2013Tecniche di programmazione11 Optimum solution: the absolute best Optimal solution: a solution that approximates the optimum one (might be coincident, but wedon’t know) can no longer be improved with the chosen optimizationtechnique Locally optimum solution: optimum solution in acontinuous domain
    • Intuitively…A.A. 2012/2013Tecniche di programmazione12xf(x)OptimumsolutionOptimalsolutionLocallyoptimumsolutions
    • Computational IntelligenceA.A. 2012/2013Tecniche di programmazione13 Evolutionary Algorithms Genetic Algorithms Genetic Programming Simulated annealing Tabu-Search
    • Branch & BoundSearch and Optimization Strategies
    • A.A. 2012/2013Tecniche di programmazione15Introduction Branch and Bound is an exact method for exploring allsolutions based on their implicit enumeration All solutions are considered, but not one-by-one. In factB&B: Considers disjoints subsets of solutions (branching) Evaluates them according to an estimate of the objectivefunction (bounding), by eliminating (pruning) those subsets thatmay not contain the optimum solution
    • A.A. 2012/2013Tecniche di programmazione16Definition z*: a sub-optimal estimate of the final result Initialized to + for minimization problems Initialized to - for maximization problems z(r)E : the exact solution of sub-problem P(r) z(r)B: a super-optimal estimate of solutions of sub-problemP(r) lower bound for minimization problems upper bound for maximization problems
    • A.A. 2012/2013Tecniche di programmazione17General algorithm (I) Branch-and-bound is a divide-et-impera method: Divide a given problem (and its set of feasible solutions) in sub-problems to be analyzed separately. Keep a list P of open sub-problems At each step, select one current problem P(r)
    • General algorithm (II)A.A. 2012/2013Tecniche di programmazione18 If P(r) has no feasible solutions, it is closed If P(r) has (at least one) solution, and may be solved up tothe optimum z(r)E P(r) is closed Its solution, with value z(r)E, may possibly replace z*, if itimproves it
    • General algorithm (III)A.A. 2012/2013Tecniche di programmazione19 Se P(r) has solutions, but it’s difficult to be solved up tothe optimum, we try to show that it may not yield abetter solution than the already known ones. We compute a super-optimal estimate z(r)B of its solutions: If z(r)B is not better than z*, all solutions in P(r) are dominatedby the best known-solution, and P(r) may be closed If z(r)B is better than z*, P(r) is broken into sub-problems thatare inserted in the list P. P(r) is closed, and the sub-problemswill be opened, eventually.
    • General algorithm (IV)A.A. 2012/2013Tecniche di programmazione20 Proceed until P is empty When P is empty, then z* is the exact optimum solutionfor the original problem.
    • The solution treeA.A. 2012/2013Tecniche di programmazione21P0P1 P2P21 P22P11 P12P111 P112P12Node: sub-problemLeaf node: closed sub-problem
    • Ingredients of a B&B algorithmA.A. 2012/2013Tecniche di programmazione22 Strategy of visit of the search tree: criteria to choose thenext sub-problem to be analyzed out of the list P Bounding technique: how to evaluate the super-optimalestimate z(r)B Branching rule: how to split the current problem P(r) intosmaller sub-problems.
    • Main featuresA.A. 2012/2013Tecniche di programmazione23 Advantages: Finds optimum solution May limit the number of visited solutions May give a partial (approximate) solution, if stopped earlier Disadvantages: Computation time for visiting the solution tree depends on thestrategy The worst case is to visit all possible nodes, anyway Time needed to compute z(r)B.
    • GreedySearch and Optimization Strategies
    • A.A. 2012/2013Tecniche di programmazione55Introduction A greedy algorithm searches for a globally optimalsolution, by choosing locally optimum ones. The adopted technique is shortsighted: Every choice made at any step is never re-considered again No back-tracking Basic principle: define an “attractiveness” for every partialsolution Attractiveness (it: appetibilità) = estimate of how much, probably,we are close to the optimum.
    • General structure (I)A.A. 2012/2013Tecniche di programmazione56 If the attractiveness {ai} of partial solutions are knownsince the beginning, and may not be modifiedGreedy ({a1, a2, …an})S  øsort {ai} in decreasing attractiveness orderfor each ai doif ai may be added to Sthen S  S  {ai}return S
    • General structure (II)A.A. 2012/2013Tecniche di programmazione57 If attractiveness may be modified by the effects ofprevious choicesGreedy2 ({a1, a2, …an})S  øcompute attractiveness of aiwhile there are element to choose dochoose the most-attractive aiif ai may be added to Sthen S  S  {ai}update the remaining aireturn S
    • ExampleA.A. 2012/2013Tecniche di programmazione58 Find the minimum number of coins to give change to acustomer. We assume we have a list of possible coin values, andtheir availability is infinite
    • A.A. 2012/2013Tecniche di programmazione59Example Available coins 20, 10, 5, 2, 1 Change to give 55
    • A.A. 2012/2013Tecniche di programmazione60Algorithm At each step, select the highest-valued coin, whose valueis less than the remaining changeRemaining change Chosen coin55 2035 2015 105 5
    • A.A. 2012/2013Tecniche di programmazione61Features Advantages Extremely simple algorithm Very fast computational time Disadvantages The solution is optimal, non necessarily optimum
    • Non-optimum solutionA.A. 2012/2013Tecniche di programmazione62 Input: Coins of 6, 4, 1 Change to give: 9 Greedy solution: 4 coins: 6, 1, 1, 1 Optimum solution : 3 coins: 4, 4, 1
    • Local SearchSearch and Optimization Strategies
    • ApplicabilityA.A. 2012/2013Tecniche di programmazione72 Suitable for problems where: There is an underlying “structure” in the solution space There is a clear objective function The search space is too vast Exact algorithms are not knows “Similar solutions have similar cost”
    • Iterative improvementA.A. 2012/2013Tecniche di programmazione73 A family of methods Common basic idea Start from an initial (random) configuration Consider various possible moves starting from that configuration Accept or refuse such moves, depending on the objective function When you cannot improve anymore, start again
    • A.A. 2012/2013Tecniche di programmazione74Example
    • MovesA.A. 2012/2013Tecniche di programmazione75 We must define a set of moves to lead from onesolution to another The set of possible moves defined the neighborhood ofa solution Moves are often implemented as small variations(mutation) on the encoded solution
    • A.A. 2012/2013Tecniche di programmazione76Example: TSP (I)“2-opt”neighborhood
    • A.A. 2012/2013Tecniche di programmazione77Example: TSP(II)3-opt neighborhood
    • Hill Climbing (I)A.A. 2012/2013Tecniche di programmazione78 For every configuration, evaluate all possible moves (explore the whole neighborhood) Refuse all moves that worsen the objective function Accept the move that leads to the highest improvementof the objective function If all moves worsen the objective function, quit.
    • A.A. 2012/2013Tecniche di programmazione79Hill Climbing (II)X = startinc configurationE = eval(X)do {N = n_moves(X)for (i=0; i<N; ++i)Ei = eval(move(X,i))if (all Ei  E)return Xi* = { i | max(Ei) }X = move(X, i*)E = Ei*} while(1)
    • FeaturesA.A. 2012/2013Tecniche di programmazione80 Greedy Simple to implement No backtracking => no recursion, no memory Needs “clever” definition of moves Sometimes, the objective function may be incrementallycomputed
    • A.A. 2012/2013Tecniche di programmazione81Problems (I) Foothill: getting trapped in local maximaHillclimber final pointStartReal maximum
    • A.A. 2012/2013Tecniche di programmazione82Problems (II) Mesa: wide regions with null or negligible variation of theobjective function Needle in the haystack: isolated peak in a desolatedlandscape
    • A.A. 2012/2013Tecniche di programmazione83Variants First-ascent Accept the first move that improves the objective function Best-ascent Evaluate all moves and accept the best one Threshold-accept Accept the first move that improves the current configuration by anamount higher that a fixed threshold …etc…
    • A.A. 2012/2013Tecniche di programmazione84Example111 fitness 10011 fitness 12101 fitness 20110 fitness 5First ascentBest ascent011 fitness 12101 fitness 20Neighborhood definition:‘complement one bit’
    • A.A. 2012/2013Tecniche di programmazione85Random Restart Hill Climbing Repeat the Hill Climbing procedure starting from many initialstarting pointsX = random configurationBest = Xdo {X’ = HillClimber(X)if (Eval(X’) > Eval(Best))Best = X’X = random configuration} while( ! Enough )
    • A.A. 2012/2013Tecniche di programmazione86Simulated Annealing Stochastic approach for function minimization The name is taken from the physical process ofcrystallization of a liquid into solid state The minimum of the cost function corresponds to thecrystal state of the substance (minimum energy) Simulated Annealing gradually “lowers” the “temperature”until the system “freezes”
    • A.A. 2012/2013Tecniche di programmazione87Algorithm (I) Start with a random solution Choose a solution in the neighborhood If the energy of the new solution is less than the current one,accept the move If the energy is more than the current one, the move may beaccepted, with a probability The probability to accept “bad” moves depends on Amount of worsening (DE) Temperature (simulated) of the system
    • A.A. 2012/2013Tecniche di programmazione88Algorithm(II)current = start statefor time = 1 to forever doT = schedule[time]if T = 0 return currentnext = a randomly chosen successor of currentdE = value(next) – value(current)if dE > 0 then current = nextelse current = next with probability edE/Tend for
    • A.A. 2012/2013Tecniche di programmazione89Features The system may “jump out” of local minima by acceptingworse solutions At higher temperatures, worsening jumps are easier, atlower temperature they become unlikely Temperature is gradually reduced At T=0, the algorithm converges to the locally optimumsolution (hill climbing behavior)
    • A.A. 2012/2013Tecniche di programmazione90Boltzmann distributiondEP(accettazione)1T=maxT=0
    • Other local search algorithmsA.A. 2012/2013Tecniche di programmazione91 Tabu Search Ant Colony Genetic Algorithms
    • ResourcesA.A. 2012/2013Tecniche di programmazione92
    • Licenza d’usoA.A. 2012/2013Tecniche di programmazione93 Queste diapositive sono distribuite con licenza Creative Commons“Attribuzione - Non commerciale - Condividi allo stesso modo (CCBY-NC-SA)” Sei libero: di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico,rappresentare, eseguire e recitare questopera di modificare questopera Alle seguenti condizioni: Attribuzione — Devi attribuire la paternità dellopera agli autori originalie in modo tale da non suggerire che essi avallino te o il modo in cui tuusi lopera. Non commerciale — Non puoi usare questopera per fini commerciali. Condividi allo stesso modo — Se alteri o trasformi questopera, o se lausi per crearne unaltra, puoi distribuire lopera risultante solo con unalicenza identica o equivalente a questa. http://creativecommons.org/licenses/by-nc-sa/3.0/