Skip to content

Instantly share code, notes, and snippets.

@felixlindemann
Created December 4, 2014 14:05
Show Gist options
  • Save felixlindemann/48ffb43e50790d89b3f7 to your computer and use it in GitHub Desktop.
Save felixlindemann/48ffb43e50790d89b3f7 to your computer and use it in GitHub Desktop.
Calculate the fitnes of the rout: number of stops in a genetic algorithm
getNumberOfStops <- function(tour){
# wieviele Stops führen zum Depot zurück?
n <- which(tour==1) # 1=depot
return (length(n))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment