APSIMInitiative / ApsimX

ApsimX is the next generation of APSIM
http://www.apsim.info
Other
136 stars 164 forks source link

Factorial trials are doubling the simulations when there are two or more managers or operations #3347

Closed mpandreucci closed 5 years ago

mpandreucci commented 5 years ago

Hi. I've been setting up factorial simulations where under each factor I need to have two managers (for example one as automatic irrigation and another as climate controller) or two operations (for example one as irrigation - for specific dates- and another to cut the pasture on specific dates). When I run these simulations, I end up having more simulations than what I should. So, I guess when I have more than one manager, or more than one operations, those are used as factors, even though they are not factors. Maybe I'm setting up the simulations wrong or maybe APSIM shouldn't be considering them as factors? I attached here a couple of screen shots. I hope it helps to explain what I'm trying to say? The first one shows how the factorial is set up. The second one shows how the simulations are being run.

Thanks

factors in the simulation simulations end up using managers as factorials

hol353 commented 5 years ago

Are you using a fairly recent build? I made some changes that should have fixed this.

hol430 commented 5 years ago

Have you merged your factor/experiment/JobRunner refactoring? Or are you talking about a different change?

mpandreucci commented 5 years ago

Yes, I've been updating it daily. I just updated it and ran them again and the same thing is still happening?

BrianCollinss commented 5 years ago

@mpandreucci Hi. May I ask how you created multi-level factors? In my simulations, I have locations (i.e. management and weather) and in each location I want to have different soils or levels of initial soil moisture. But it fails to run. I attach images showing how I prepared the factors. Cheers.

image

image

mpandreucci commented 5 years ago

Hi Ben. I had locations as factors. In each location I had different managers, soils and weather (you can see in the screenshot what I had under each location). Then, as a base simulation, I had a standard simulation where I had soil, weather and managers (and operations) that referred to the ones I had under each location. Then, at the factor level (like your screenshot) I had the references for the managers or operations I needed. I attached here a screenshot, I hope that helps. Let me know if it doesn't. github

BrianCollinss commented 5 years ago

Thanks @mpandreucci. So the 'Location' factor is not directly copied on any object in the base simulation. What I am looking to do is to have nested factors. For example, imaging you could have two different Operations under each location so APSIM would run the combination of Location and Operation for each location (and Operations are different in each location).

Thanks. Cheers.

BrianCollinss commented 5 years ago

@mpandreucci by the way, I think the way you had done it, you would end up with all the combinations of the factors. I did. For each location, I put all the operations, etc. under a folder which is linked to a folder in the base simulation. That way, I would only have one management for each location and not all the combinations of management components.

image

mpandreucci commented 5 years ago

Yes, that's the problem. I don't want to run the combinations, that's why I had to disable them.

BrianCollinss commented 5 years ago

You can put them under one folder for each location and link the folder to a folder in the base simulation.

mpandreucci commented 5 years ago

I'll give that a go. Thanks

sno036 commented 5 years ago

@hol353 @hol430 Unfortunately the solution suggested by @BenAbabaei didn't work for @mpandreucci. And the UI is not 'listenting' to the true/false in the enabled/disabled simulations as controlled on the Experiment node (e.g. it says it is going to run 10 simulations but managed to actually run 25/10 simulations!). We can put a bunch of work into work-arounds that will end up with some messy validation simulations but just wanted to check to see if fixing this is on the active list below doing that. Thanks, Val and Mariana

hol430 commented 5 years ago

I think @hol353 is working on a big overhaul of the whole experiment/factor/simulation system, but it's unlikely that that branch will be merged this year.

BrianCollinss commented 5 years ago

@sno036 Have a look at this thread (https://github.com/APSIMInitiative/ApsimX/issues/3378) and the file I provided. That method worked for me. Of course I am still struggling to have nested factors. But it works if you only have locations and other factors that are to be applied in all locations the same way. BTW, I could not do the same as what you did with [Clock].StartDate and EndDate in your factors. Not sure if the factors work that way. Pls let me know if they do. Cheers.

sno036 commented 5 years ago

Hi @BenAbabaei - the start/end date were applied as shown below. Not sure if that answers your question. image

hol430 commented 5 years ago

@mpandreucci @sno036 If you pull down the latest changes, this should be fixed. I think.

mpandreucci commented 5 years ago

Yup, I saw that now the output only shows the data from the simulations that are enabled. The experiment node still shows all the possible factorials, but I just used the enable/disable command anyway. Thanks, Mariana

hol430 commented 5 years ago

Not sure why you're still seeing all factorials...are you able to upload your .apsimx file? You will need to zip it up to attach it to the github issue (or just rename it and give it a .txt file extension).

mpandreucci commented 5 years ago

Hi Drew. I've just updated everything again and its all good. Thanks a lot for that.