function [mu,y,g,a]=fdsa(mu0,a0,M,R,mode,delta) %Stochastic approximation to minimize the response of %a GI/G/1 queueing model with respect to mean service time mu of customers % %INPUT: % %mu0 Initial solution %a0 Initial step size %M Maximum number of iterations %R Number of replications per simulation model evaluation %mode Type of gradient estimate % 1: finite difference, independent replications % 2: finite difference, common random numbers % 3: infinitesimal perturbation %delta Perturbation of decision variable % %OUTPUT: % %mu Trajectory of decision variable values %y Simulation model responses %g Gradient estimates %a step sizes %Queueing model parameters n=100; %Number of customers to simulate lambda=1; %Arrival rate of customers sigma=0.1; %Standard deviation of service time c=2; %Cost mu=mu0; k=0; %iteration count while k