function val = max_adj_return_fn(wj, pj,qj) % MAX_ADJ_RETURN_FN - Returns the mean divided by standard deviation of the horse track betting problem % % Note 1: wj has N-1 elments the last element wj(N) is computed from the previous N-1 i.e. = 1 - sum( wj ) % % Note 2: we use a logistic regression approximation to map the inputs from (-\infty,+\infty) to the range (0,1) % % Written by: % -- % John L. Weatherwax 2006-12-31 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % turn everything into columns: % wj = wj(:); pj = pj(:); qj = qj(:); % compute the first N-1 logistic mapped log weights and then the Nth one from all the N-1 others: % lwj = exp( wj )/( 1 + sum(exp(wj)) ); lwj = [ lwj; 1-sum(lwj) ]; % compute the mean % m = sum( pj .* lwj .* ( qj + 1 ) ) - 1; % compute the standard deviation: % val = sqrt( sum( pj .* ( lwj .* ( qj + 1 ) - 1 - m ).^2 ) ); % return the (negative) ratio so we can use a minimization routine to find this maximum: % val = -m / val;