From: Robert Klemme Date: 2009-11-25T00:33:26+09:00 Subject: Re: ideas for a "parameter sweep" program? 2009/11/24 Diego Virasoro : > On 24 Nov, 12:36, Robert Klemme wrote: >> 2009/11/23 Diego Virasoro : >> >> > I often need to run my computational experiments with a combination of >> > parameter values, and I was thinking of automatising it with Ruby. Any >> > idea on what would be the best way to go about it? >> >> Not sure what you actually mean.  Are you looking for something like >> >> p1 = [1,2,10,3] >> p2 = [1312,42345,235435,65] >> p3 = [123,23,476,43] >> >> p1.each do |param1| >>   p2.each do |param2| >>     p3.each do |param3| >>       system "experiment", param1, param2, param3 >>   end >> end >> > > Yep, something like this in its simplest form. > But I'd like to make it a little more generic and powerful, for > example allowing for some action before or after the main call, for > the user to express the name of the experiment, for actions before or > after the whole script, etc... Then you should probably start with filling on those dots. If the required feature set is unclear the proposed solution might be inappropriate. > The question wasn't how to do it, but what would be the best way to do > it, if you see what I mean. I've got a few ideas and I am not sure > what will work because some (like a DSL) I've never done before and > others (like a Yaml file) may not be enough. As I said: first it needs to be clear what needs to be done. What kind of inputs do you need or want (a single configuration file or a number of files, should it be controlled by some command line arguments etc.) and what actions do you need. Are the actions before and after the experiment uniform or do they depend on the command line args of that particular execution. Things like that can make a difference for the viability of any solution. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/