Hi again,

So with 2 parameters you would do something like

for param1 in $(seq 1 10)
do
  for param2 in $(seq 1 100 10)
  do

    [ check if this simulation has been run already ] && continue

    # do the simulation, e.g for ns-3
    ./waf --run "scratch/myfirst \
      --ns3::PointToPointNetDevice::DataRate=${param2}Mbps \
      --ns3::PointToPointChannel::Delay=${param1}ms"
    # or in ns-2 
    ns myfile $param1 $param2
    # or the equivalent for other simulation software

    move results files and logs to the right place

  done
done

which will fill your parameter space like this:

param1
 ^
 | 5 10
 | 4  9
 | 3  8 13
 | 2  7 12
 | 1  6 11
 +-------------------------------> param2

Which means you can't really visualize your results until all
simulations are done. 

I made a script that uses another enumeration method, getting more and
more into detail, like in this order:

param1
 ^
 | 2             7             3
 | 
 | 6             
 | 
 | 1             5             4
 +-------------------------------> param2

The benefit is that you can do e.g. 25 simulations to get a rough
feeling how the output will be, and then extend to 289, 1089, ...
simulations (as detailed as you want), by always halfing the space
between the points.

You can find an explanation and a generating script at
http://johannes.jakeapp.com/blog/category/science/200909/exhausting-a-finite-parameter-space-by-enumerating-qn

So your call would become (for the first 25 parameter pairs):

#   number of parameters      scaling from [0:1] to [1:10]
               |              \                      / 
./numbering.py 2  0  3 | awk '{print $1*9+1,$2*99+1}'  |
while read param1 param2
do
    [ check if this simulation has been run already ] && continue
    run simulation with $param1 $param2
    move results files and logs to the right place
done

I hope that explanation was understandable, it is easier on a
piece of paper.

Just throughing random points at your parameter space will be equally
effective (you cover the parameter space with increasing density), but
this is a deterministic method.
An arbitrary number of parameters (dimensions) is possible.

It benefits me because the intermediate results are representative, and
I can already do visualizations while the rest of the simulations
finish. I can let the simulations run up until I write the report to
gain more confidence.


Best regards,
Johannes


On Thu, 17 Sep 2009 08:02:00 +0200
Basim Javed <[email protected]> wrote:

> hi
> 
> Normally we have to call NS several times, which is not elegant
> approach, doing it using bash works.
> I do not know other approach, so maybe you would share yours?
> 
> cheers
> Basim
> 
> On Tue, Sep 15, 2009 at 4:42 AM, Johannes Buchner
> <[email protected]>wrote:
> 
> >
> >
> > Hi!
> >
> > When doing a simulation, you usually have a few parameters that you
> > want to vary, right? For example, the number of nodes, or the
> > throughput, could be parameters you want to test within certain
> > ranges. And you want to run your simulation several times with
> > varying each parameters.
> >
> > This might seem like a dumb question, but anyways:
> > How do you usually do that? Do you just make several for loops
> > inside the program? Or outside (e.g. using bash)? Do you use random
> > points in this parameter space?
> >
> > This strikes me as a issue to all simulations, not specifically
> > ns-[23]. Now I found a way that works great for me (which I'm happy
> > to share), but I was wondering what your usual strategy is.
> >
> > Best regards,
> > Johannes
> >

-- 
Emails können geändert, gefälscht und eingesehen werden. Signiere oder
verschüssele deine Mails mit GPG.
http://web.student.tuwien.ac.at/~e0625457/pgp.html

Reply via email to