changing config

Requests regarding how to set up experiments in ARGoS.
pincy
Site Admin
Posts: 375
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: changing config

Postby pincy » Thu Jul 04, 2019 6:46 pm

There are two examples on how to accomplish this here: https://github.com/ilpincy/argos3-examp ... /embedding
I made ARGoS.

dmb
Posts: 12
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Thu Jul 04, 2019 7:23 pm

those programs run only a single step of the while loop, choosing only a single configuration, so that is not really what I desired.

Or maybe you just wanted to show Destroy function. I was aware of it but it did not seem to accomplish destroying the previous initialisation.

Some time ago I used the code :
static argos::CSimulator &cSim = argos::CSimulator::GetInstance();
static SomeLoopFunctions &cLoopFunctions = dynamic_cast<SomeLoopFunctions &>(cSimulator.GetLoopFunctions());
cSim.Destroy();
static argos::CSimulator &cSim2 = argos::CSimulator::GetInstance();
cSim2.SetExperimentFileName(filename);

/* Load it to configure ARGoS */
cSim2.LoadExperiment();
but then that gave me errors about controllers being duplicated:
"Controller id \"" << strId << "\" duplicated"
Just wondering if that, or a similar strategy, could work.

pincy
Site Admin
Posts: 375
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: changing config

Postby pincy » Thu Jul 04, 2019 7:30 pm

No, you didn't understand what the example code does. Please take some time to read it in detail because it really is what you're trying to do. The code you're writing is not correct, because ARGoS is a singleton.

For both the MPGA and GALIB examples, when an instance of ARGoS is created, it lives as long as the entire optimization process. Both examples run an experiment from start to end for each optimization step. Before each step, some form of reconfiguration is done to prepare the next experimental run. In other words, this code performs back-to-back simulations without the need to destroy and recreate the ARGoS instance.

The idea in that code is that there are some special loop functions that offer the method SetTrial(). That method does the job of configuring the experiment and that's what you'd write for your own code. Then, the Reset() method is called to restart the experiment, and Execute() runs it.
I made ARGoS.

dmb
Posts: 12
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Thu Jul 04, 2019 8:34 pm

For both the MPGA and GALIB examples, when an instance of ARGoS is created, it lives as long as the entire optimization process.

that's my main issue as this means I can only load from one configuration file, and have to make manual adjustments from there.


There is no difficulty in performing back-to-back simulations as such; my issue is to try to reconfigure from an argos-file rather than reinventing argos and setting every entity and configuration manually -- it might be possible, annoying but possible, and I think I will now have to look into it. the SetTrial my be useful as a template but just sets the trial number so that in itself is not so useful. It would be good to be able to do Init again at some time during the run, for example before the trials loop, based on a different configuration file, but that does not seem possible.

pincy
Site Admin
Posts: 375
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: changing config

Postby pincy » Thu Jul 04, 2019 8:46 pm

that's my main issue as this means I can only load from one configuration file, and have to make manual adjustments from there
I don't understand very well what you're trying to do, you seem to suggest that you need to throw away a file completely and reload it. If that's the case, you might try to (i) explain better what you need (I might be able to help to simplify your setup) and (ii) rethink from scratch the way you're setting up your experiments to work with the way ARGoS is designed instead of against it.
SetTrial my be useful as a template but just sets the trial number so that in itself is not so useful
The implementation of SetTrial() is just an example - you can reimplement it the way you like.
I made ARGoS.


Return to “How to... ?”



cron