# GRASP

```R.Jalali
heuristics: focus on solution
structure
 Simplest heuristics exploit structural properties of
feasible solutions in order to quickly come to a good
one.
 They belong to one of two main classes: constructive
heuristics or local search heuristics.
Vittorio Maniezzo - University of Bologna Transportation Logistics
2/65
Constructive heuristics
 A constructive approach can yield optimal
solutions for certain problems.
 In other cases it could be unable to
construct a feasible solution.
Vittorio Maniezzo - University of Bologna Transportation Logistics
3/65
The GRASP metaheuristic
GRASP: Greedy Randomized Adaptive Search Procedure
The GRASP metaheuristic has two phases:
 a constructive phase, that constructs a good initial
solution x.
 an improving phase, that is applied to the initial
solution x.
(the improving phase consists in a restricted VNS)
Both phases are repeated until the stopping criterion is
met.
The Constructive Method of GRASP
 A constructive method:




items are iteratively added to an initially empty
structure until a solution of the problem is obtained.
A heuristic constructive procedure:
The choice of the item based heuristic evaluation(s):
measure(s) of the convenience of considering
the item as belonging to the solution.
The evaluation depends on the items already in the solution.
The greedy strategy:
Choose the item that optimize the evaluation (the best item)
A randomized rule:
Use random numbers in the choice.
The GRASP rule
 Choose (at random) one of the best items.
The evaluations by:
 The wasted areas
 The smoothness of the upper contour.
The best items are those that best fit to the upper contour
 Construct a Restricted Candidate List of items that
contains the best items, then choose one item of the list
Generalized GRASP
Sequence
of customers
visited
AA
Basically,
GRASP =
greedy solution +
local search
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Greedy
phase
Basically,
Visit customer that
can be served
earliest from A
GRASP =
greedy solution +
local search
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Greedy
phase
Basically,
Next, visit customer
than can be served
earliest from D
GRASP =
greedy solution +
local search
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Greedy
phase
Basically,
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Feasible
Value = 34
GRASP =
greedy solution +
local search
Continue until all
customers are
visited.
This solution is
feasible. Save it.
Generalized GRASP
AA
Local
search
phase
Basically,
Backtrack
randomly
Feasible
Value = 34
GRASP =
greedy solution +
local search
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Local
search
phase
Basically,
Feasible
Value = 34
Delete
subtree
traversed
GRASP =
greedy solution +
local search
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Local
search
phase
Basically,
GRASP =
greedy solution +
local search
Randomly select
partial solution
in neighborhood
of current node
Feasible
Value = 34
Begin with greedy
assignments that
can be viewed as
creating
“branches”
Generalized GRASP
AA
Greedy
phase
Feasible
Value = 34
-
Complete
solution in
greedy
fashion
Generalized GRASP
AA
Local
search
phase
Randomly
backtrack
Feasible
Value = 34
-
Generalized GRASP
AA
AB    A
ABD   A
Continue in
similar fashion
ABDECA
Feasible
Value = 34
-
-
Exhaustive search algorithm (branching search) suggests a
generalization of a heuristic algorithm (GRASP).
GRASP
 GRASP (Greedy Randomized Adaptive Search Procedure)
restarts search from another promising region of the search
space as soon as a local optimum is reached.
 GRASP consists in a multistart approach with a suggestion on
how to construct the initial solutions.
 1.
Build a solution S (=S* in the first iteration) by a
constructive greedy randomized procedure based on
candidate lists.
 2. Apply a local search procedure starting from S and
producing S'.
 3. If z(S')&lt;z(S*) then S*=S'.
 4. If not(end condition) go to step 2.
The end
```