MesserLab / SLiM

SLiM is a genetically explicit forward simulation software package for population genetics and evolutionary biology. It is highly flexible, with a built-in scripting language, and has a cross-platform graphical modeling environment called SLiMgui.
https://messerlab.org/slim/
GNU General Public License v3.0
160 stars 30 forks source link

runtime error in setConstraints()? #405

Closed jiseonmin closed 10 months ago

jiseonmin commented 10 months ago

Hi Ben, I am trying out setConstraints(). I am trying to make local competition to be only between juveniles (i1) and mating to be between adults (i2). Here is part of my code:

    initializeInteractionType(1, "xy", reciprocal=T, maxDistance=SI * 3);
    i1.setInteractionFunction("n", 1.0/sqrt(2*PI*SI^2), SI);
    i1.setConstraints("both", maxAge = MATURATIONTIME);

    initializeInteractionType(2, "xy", reciprocal=T, maxDistance=SM * 3);
    i2.setInteractionFunction("n", 1.0/sqrt(2*PI*SM^2), SM);
    i2.setConstraints("receiver", sex="M", minAge = MATURATIONTIME + 1);
    i2.setConstraints("exerter", sex="F", minAge = MATURATIONTIME + 1);

The error says 'setConstraints() requires minAge <= maxAge' even though the constraints are for two different interactions. Maybe I am misunderstanding how to use setConstraints() or maybe this is a bug?

bhaller commented 10 months ago

Yep, it was a bug, sorry. Just committed a fix, pushed to GitHub; should work now, although I haven't tested it. (After work hours over here, but it was a quick fix. :->) Reopen if a problem remains. Thanks!