Why are parameters are a list on `single_proc` mode?

I’ve been writing the Robots and Marbles part 7 tutorial, and wrote two sections, one to describe parameters, and another to describe parameter sweeping.

In the first section I use a single_proc execution mode and I receive a list of parameter objects as an argument in params. When I use multi_proc, I receive be object directly, so I have to define the robot_arm policy twice, in In[5] and In[9].

Is there a reason for that? Am I doing something wrong?

Thanks for flagging this, @sembrestels. I don’t see you doing anything wrong. In a future version of cadCAD we could probably make it so that the params argument passed to the policy and state update functions is always a dict (as is the case with multi_proc) and not a list (as with single_proc). We’ll look into it!

In any case, I would generally recommend as a best practice to avoid the use of single_proc when dealing with the params dictionary. Even in preliminary versions of a model, when I’m not yet sweeping a parameter, I use the config_sim + append_configs + multi_proc combo, as in this Gist. This saves a lot of headaches with refactoring as the experiment matures and it’s time for parameter sweeping.

1 Like