One of the powerful heuristics we use is based on the traditional greedy method, by which a solution is constructed incrementally from most-promising elements selected from a pool of possible extensions. We generalize this abstract greedy strategy to a local-search greedy method, by viewing each possible extension as a neighboring solution so that the act of extending a solution is considered as moving from one solution to its most promising neighbor.
Extend_cost takes a solution and a mutation and returns the cost of
the extension from the solution to an extending neighbor obtained by
extending the given solution. Extension is defined by inserting
an element into a position
; mutation_element::first
indicates a position
, and mutation_element::second
indicates the element to be inserted into
.
The meaning of this extension (
and
) depends on the solution
representation:
For TSP, extend_cost is:
![]() |
In DISCROPT, it is written as:
double ObjectiveFunction::extend_cost(CircularPermutation & sol, const mutation_element &mut_el) { double weight=0; int pos = mut_el.first, prev_pos = sol.previous_index(mut_el.first); int new_ele = mut_el.second; if(pos > sol.last_index()) pos = sol.first_index(); weight = search_space->edge_weight(sol[prev_pos], new_ele) + search_space->edge_weight(new_ele, sol[pos]) - search_space->edge_weight(sol[prev_pos], sol[pos]); return weight; }
Delta_extend must be defined so that