Show
Ignore:
Timestamp:
01/12/10 20:26:09 (14 years ago)
Author:
smidl
Message:

ARENA + MC experiment

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/tutorial/mpdm/dist_ctrl_example.m

    r765 r774  
    3131C1.Qy = 1*eye(1); 
    3232C1.yreq = 1; 
    33 C1.horizon = 100; 
     33C1.horizon = 5; 
    3434 
    3535C2=C1; 
     
    4242P1.merger.class = 'merger_mix'; 
    4343P1.merger.method = 'geometric'; 
    44 P1.neighbours = {'P2'}; 
     44%P1.merger.dbg_file = 'mp.it'; 
     45P1.merger.ncoms = 20; 
     46P1.neighbours = {};%{'P2'}; 
    4547 
    4648P2=P1; 
     
    4951P2.neighbours = {}; 
    5052 
    51 exper.ndat = 100; 
    52 exper.burnin = 10; 
     53exper.Ndat = 10; 
     54exper.burnin = 3; 
    5355exper.burn_pdf.class = 'enorm<ldmat>'; 
    5456exper.burn_pdf.mu = [0;0]; 
     
    5658 
    5759 
    58 M= arena(DS,{P1,P2},exper); 
     60%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MONTE CARLO %%%%%%%%%%%%%%%%%%% 
    5961 
     62Ntrials = 100; 
     63loss_non_coop = zeros(1,Ntrials); 
     64for i=1:Ntrials 
     65    M= arena(DS,{P1,P2},exper); 
    6066 
    61 %%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    62 %       PLOTS 
    63  
    64 figure(1); 
    65 hold off 
    66 subplot(1,2,1); 
    67 plot(M.DS_y); 
    68 subplot(1,2,2); 
    69 plot(M.DS_u1); hold on; 
    70 plot(M.DS_u2);  
    71  
    72 figure(2); 
    73 hold off 
    74 plot(M.Ctrl0_apost_mean_theta); 
    75 hold on 
    76 plot(M.Ctrl0_apost_ub_theta,':'); 
    77 plot(M.Ctrl0_apost_lb_theta,':'); 
    78 set(gca,'YLim',[-4,2]); 
    79  
    80 figure(3); 
    81 hold off 
    82 plot(M.Ctrl1_apost_mean_theta); 
    83 hold on 
    84 plot(M.Ctrl1_apost_ub_theta,':'); 
    85 plot(M.Ctrl1_apost_lb_theta,':'); 
    86 set(gca,'YLim',[-2,3]); 
     67    loss_non_coop(i) = M.DS_y'*C1.Qy*M.DS_y + M.DS_u1'*C1.Qu*M.DS_u1 + M.DS_u2'*C1.Qu*M.DS_u2; 
     68end 
     69mean(loss_non_coop)