Monday, February 27, 2017

Local optimization – general idea

proc improveTour(tour: var Tour_Array) =
  ## scheme of most of local improvement algoritms
  var
    locallyOptimal: bool = false
    improved: bool
  
  while not locallyOptimal:
    locallyOptimal = true
    for pos in low(tour) .. high(tour):  # that is: in 0 .. N-1
      improved = false
      improved = optimizeFromPosition(pos)  # opt. trial
      if improved:
        locallyOptimal = false
        break

No comments:

Post a Comment