Optimization: principles and algorithms, by Michel Bierlaire
randomFromAtoB.m
Go to the documentation of this file.
1 %> \file
2 %> Compute a random integer between A and B
3 %>
4 %> @note Called by \ref twoOptRandomNeighbor
5 %>
6 %> @author Michel Bierlaire
7 %> @date Sun Apr 19 13:41:06 2015
8 %> @ingroup Algorithms
9 %> @ingroup chap27
10 
11 %> Compute a random integer between A and B
12 %> @param A lower bound
13 %> @param B upper bound
14 %> @return r random number
15 function r=randomFromAtoB(A,B)
16  r = 1+floor((A-1)+(B-(A-1))*rand()) ;
17 endfunction
function randomFromAtoB(in A, in B)
Compute a random integer between A and B.
function twoOptRandomNeighbor(in cities)
Generate one random 2-opt neighbor for the TSP.
Copyright 2015-2018 Michel Bierlaire