%% To run MATLAB in parallel (helps speed up simulation)

matlabpool open 2  

%% opens two processes
%% for e.g. a quad core machine, could specify up to 4



%% Initialise parameters and design choices (see InitParamOptions.m)

ParamOptions = InitParamOptions( SAMPLESIZE )



%% To run single simulation of size SAMPLESIZE (see AmbulanceFitness.m)

RESULT = Ambulance_Fitness (DESIGN_CHOICE,ParamOptions,SE)

%% DESIGN_CHOICE is a particular design choice matching the design choice structure in InitParamOptions.m 
%% e.g. DESIGN_CHOICE = [1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0] for Blocks = [4 7 10 13 19]
%% denotes a design choice of [Option 1 of 4,Option 1 of 3,Option 1 of 3,Option 2 of 3,Option 4 of 6]
%%
%% SE is desired maximum standard error
%% e.g. SE = 0.1
%%
%% RESULT is a tuple containing values of objective functions (in this example we currently have just Cost and 14MinResponseRate)



%% To run single optimisation with simulations of size SAMPLESIZE (see Run_Optimisation.m)

RESULT = Run_Optimisation(SAMPLESIZE,SE)

%% where SE is desired maximum standard error
%%
%% RESULT is a structure:
%% 	RESULT.Designs contains the bitstring representation of the optimal designs
%%	RESULT.Values contains the value-tuples for the objective functions for these optimal designs
%%	RESULT.Costs contains just the Cost values from Values
%%	RESULT.FourteenMinuteResponseRate contains just the 14MinResponseRate values from Values




%% The MATLAB Global Optimisation toolbox needed to be customised slightly.
%% I have edited gacreationuniform.m and crossovertwopoint.m both found in the globaloptim folder.
%% I have marked the lines that were edited. 
