Dear Julia users,

For a computationally challenging problem I'm trying to port an existing 
design-optimization from MATLAB to Julia. Currently, the designs are 
organized in a MATLAB struct and I am looking for some advice on how to 
efficiently store and distribute the data for a parallel evaluation in 
Julia. The idea of the MATLAB algorithm is to make some random changes in 
each design, re-calculate their effiency (using everything in the MATLAB 
struct) within a parallel loop, and sorting the designs based on their 
updated efficiency. Below is how the data is organized in Matlab. I figured 
a composite type ( http://julia.readthedocs.org/en/latest/manual/types/ ) 
would be the relevant Julia structure, but I am not sure how to create a 
vector of composite types and whether to use "type" or "immutable". Hence, 
a specific suggestion about how to do this in Julia would be much 
appreciated!

Thank you and best regards,
Marcel


% setup structure to save designs (only once)
for d = 1:100
 design(d).efficiency = 99;
 design(d).ind_eff    = zeros(8,10000);
 design(d).design   = zeros(14,12,8);
 design(d).X          = zeros(196,22,8);
 design(d).dX        = zeros(144,22,8);

  for subNr=1:8
   for drawNr = 1:10000
    design(d).draws(subNr,drawNr).V             = zeros(144,1);
    design(d).draws(subNr,drawNr).expV        = zeros(144,1);
    design(d).draws(subNr,drawNr).sumExpV = zeros(144,1);
    design(d).draws(subNr,drawNr).P             = zeros(144,1);    
    design(d).draws(subNr,drawNr).PdX         = zeros(144, 22);
    design(d).draws(subNr,drawNr).sumPdX  = zeros(144, 22);
    design(d).draws(subNr,drawNr).ZZ          = zeros(22,22);
   end
  end
end 


% update efficiency 
parfor d = 1:100
  updateEff( design(d) );
end

% sort designs based on updated efficiencies
[~,v]=sort( [design.efficiency] );
design=design(v);    





Reply via email to