function act disp('Proof of existence for balance scale hysteresis patterns.'); % See description of myact for explanation of parameters. Only the % parameters written in capitals are being estimated by the fmincon % function. % DC di d nr T thr beta rehearsals secs lowers = [1.0; -1; 0.3; 100; 200000; 0; 0; 1; 3]; startparams = [4.0; 0; 0.5; 100; 200000; 0; 0; 1; 15]; uppers = [10.0; 1; 0.7; 100; 200000; 0; 0; 1; 30]; % % DC/di: saliency = (diff / dc) - di % d: d in ACT-R baselevel calculation function (fixed at 0.5) % NR: number of references % T: "age" of the distance chunk (combination of NR and T determines baselevel) % thr: retrieval threshold for chunks % beta: beta in ACT-R baselevelcalculation function (scale-factor) % nR: "number of rehearsals" of retrieved distance chunks % % Modify parameters slightly, to avoid local minima. startparams = adjustParams(lowers,startparams,uppers); startparams % Print parameters after modification. fprintf('dc: %12.6f\n',startparams(1)) fprintf('di: %12.6f\n',startparams(2)) fprintf('d: %12.6f\n',startparams(3)) fprintf('nr: %12.6f\n',startparams(4)) fprintf('t: %12.6f\n',startparams(5)) fprintf('threshold: %12.6f\n',startparams(6)) fprintf('beta: %12.6f\n',startparams(7)) fprintf('rehearsals: %12.6f\n',startparams(8)) fprintf('interval: %12.6f\n',startparams(9)) global OBS; global DIFF; % "Emperical sequence", a vector of booleans wheter or not a chunk is % retrieved. OBS = [ 0 0 0 1 1 1 1 1 0 0 0 ]; % The difference between the distances from the fulcrum on the left and % right side for the peg with the weights. DIFF = [ 1 2 3 4 5 6 5 4 3 2 1 ]; global VERBOSE; global OUTFILE; VERBOSE = 0; % During fitting, no output. OUTFILE = 1; % StdOut global EXTBL; EXTBL = 1; options = optimset( 'Display' , 'iter', 'TolCon', 0, 'TolFun', 0.0001, ... 'TolX', 0, 'MaxFunEvals', 500 ); % Find the best fit. [ endparams , fit, exitflag ] = fmincon('myact', startparams, [], [], [], ... [], lowers, uppers, [], options); VERBOSE = 1; myact(endparams); interpretExitflag(exitflag); % If a perfect fit was found, write the fitted model and the paramters % to a file which name is equal to the concatenation of the OBS vector. if (fit == 0.0) outfilename = sprintf('%d%d%d%d%d%d%d%d%d%d%d.out',OBS); fprintf('Output in: %s\n',outfilename); OUTFILE = fopen(outfilename,'w'); myact(endparams); fclose(OUTFILE); end