Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some SDM models behave incorrectly when running headless #35

Closed
SethTisue opened this issue Nov 22, 2011 · 1 comment
Closed

some SDM models behave incorrectly when running headless #35

SethTisue opened this issue Nov 22, 2011 · 1 comment
Assignees
Labels
Milestone

Comments

@SethTisue
Copy link
Collaborator

Kevin Zollman supplied the example System Dynamics Modeler diagram below.

in the GUI, this is read in by JHotDraw, which handles it correctly. but we can't use JHotDraw from org.nlogo.headless, so we rolled our own code in sdm.AggregateManagerLite to read SDM diagrams, and that code fails on this case.

NetLogo 4.1 has the same issue.

0.01
    org.nlogo.sdm.gui.AggregateDrawing 9
        org.nlogo.sdm.gui.ConverterFigure "attributes" "attributes" 1 "FillColor" "Color" 130 188 183 242 296 50 50
            org.nlogo.sdm.gui.WrappedConverter "type-1 + ( type-2 * 3)" "type-1-fitness"
        org.nlogo.sdm.gui.ConverterFigure "attributes" "attributes" 1 "FillColor" "Color" 130 188 183 369 293 50 50
            org.nlogo.sdm.gui.WrappedConverter "type-2 * 2" "type-2-fitness"
        org.nlogo.sdm.gui.StockFigure "attributes" "attributes" 1 "FillColor" "Color" 225 225 182 177 107 60 40
            org.nlogo.sdm.gui.WrappedStock "type-1" "0.01" 0
        org.nlogo.sdm.gui.StockFigure "attributes" "attributes" 1 "FillColor" "Color" 225 225 182 479 108 60 40
            org.nlogo.sdm.gui.WrappedStock "type-2" "0.99" 0
        org.nlogo.sdm.gui.ConverterFigure "attributes" "attributes" 1 "FillColor" "Color" 130 188 183 501 286 50 50
            org.nlogo.sdm.gui.WrappedConverter "(type-1 * type-1-fitness) + (type-2 * type-2-fitness)" "ave-fitness"
        org.nlogo.sdm.gui.ReservoirFigure "attributes" "attributes" 1 "FillColor" "Color" 192 192 192 103 101 30 30
        org.nlogo.sdm.gui.RateConnection 3 133 117 149 119 165 121 NULL NULL 0 0 0
            org.jhotdraw.figures.ChopEllipseConnector REF 11
            org.jhotdraw.standard.ChopBoxConnector REF 5
            org.nlogo.sdm.gui.WrappedRate "type-1 * (type-1-fitness - ave-fitness)" "t1-replicator"
                org.nlogo.sdm.gui.WrappedReservoir  REF 6 0
        org.nlogo.sdm.gui.ReservoirFigure "attributes" "attributes" 1 "FillColor" "Color" 192 192 192 396 110 30 30
        org.nlogo.sdm.gui.RateConnection 3 426 125 446 125 467 126 NULL NULL 0 0 0
            org.jhotdraw.figures.ChopEllipseConnector REF 17
            org.jhotdraw.standard.ChopBoxConnector REF 7
            org.nlogo.sdm.gui.WrappedRate "type-2 * (type-2-fitness - ave-fitness)" "t2-replicator"
                org.nlogo.sdm.gui.WrappedReservoir  REF 8 0

in the generated code, in system-dynamics-go in the GUI we see:

  let new-type-1 ( type-1 + local-t1-replicator )
  let new-type-2 ( type-2 + local-t2-replicator )

but from headless (adding println(source) to AggregateManagerLite.load and running headless.Main with run --model /Users/tisue/Desktop/PD-replicator.nlogo --experiment experiment) we see:

  let new-type-1 ( type-1 + local-t1-replicator )
  let new-type-2 ( type-2 )
@ghost ghost assigned SethTisue Nov 22, 2011
@SethTisue
Copy link
Collaborator Author

This issue can be worked around as follows. In headless, incorrect code is being generated and run. But in the GUI, the generated code is correct. So you can take the correct code from the Code tab in the SDM window, copy it, and paste it into the Code tab in the main window. Then, delete the SDM diagram. The resulting model should work properly both in the GUI and headless.

SethTisue added a commit that referenced this issue Nov 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant