0
votes

I am new to this and lost about how to create visualization for the AnyLogic sensitivity analysis. Here is the summary:

I have dataset that captures dependent and independent variables at the end of simulation run (just captures one pair at the end). Trying to vary independent variable to see the impact on dependent variable. The resulting dataset is correct (when I copy and paste in Excel) but the chart looks blank.

Also, output states that it completed 5 iterations but I specified 10 and the data shows that there were in fact 10 iterations.

There are no parameters for the chart data (see the screenshot) but I am guessing it is automatically populated at the end simulation based on the code (also copied below)? Otherwise, I cannot figure out what goes into the chart data (tried to manually enter variables/datasets to no avail).

This is the code after each simulation runs:

Color color = lerpColor( (getCurrentIteration() - 1) / (double) (getMaximumIterations() - 1), blue, red );
chart0.addDataSet( root.died_friend, format( root.SocFriendBrave ), color, true, `Chart.INTERPOLATION_LINEAR, 1, Chart.POINT_NONE );`

I realize this is a very basic question but I am lost and cannot get on the right path based on the help I found. thank you. Chart output

chart settings

actual data copied from the chart

2
Thanks @Felipe. The dataset is not empty during the sensitivity experiment, I am able to copy actual data from the chart (the last screenshot ), I am just not able to get it display on the chart. Not sure whether the chart0.addDataSet(... is supposed to add data in the chart and trying to figure it out. P.S. I don't use java action to populate dataset in the experiment, I just define to the dataset size as 1 and then specify to update it on the last day of the simulation.mvoltin
Thank you, @Stuart Rossiter. I think I found the problem. While output (scaler or dataset) was defined at top-level agent, it was referencing value of another agent ("people.nInfected()" Issue solved.mvoltin

2 Answers

0
votes

Let's say you have 2 experiments: simulation (normal one) and sensitivity analysis (new one)

The only way for the chart to look blank is if your dataset died_friend is empty. This can happen for many reasons, but the reason I suspect it happens here, is because you fill this dataset with information at the end of the simulation run, which means that you are probably using the java actions of the simulation experiment.

The sensitivity experiment DOES NOT read what you write on the java actions of the simulation experiment, so that might be the problem.

If this is not the case, you need to check other possible reasons on why your dataset is empty when you run the sensitivity analysis.

Remember: the fact that your dataset has data in your simulation experiment, does not necessarily mean the dataset will not be empty on the sensitivity experiment.

0
votes

Since the Sensitivity Analysis experiment is set up via the wizard, it would be better if you showed us how you'd set that up, rather than the resultant AnyLogic-generated code.

From what you've said here, it looks like you may be incorrectly trying to use datasets instead of scalar values. If there's one 'dependent variable' (model output of interest) then the 'independent variable' needs to be a model parameter (parameter of your top-level agent, normally Main, which the experiment will be varying).

So you should specify:

  • Varying the relevant parameter (looks like you wanted it to be 0, 0.25, 0.5, 0.75, 1 so min 0, max 1 with step size of 0.25)

  • Producing a chart for the scalar output you want. (If this was, say, a variable called outputValue, you'd use expression root.outputValue when setting up the chart in the wizard.)

Also you should only be getting more than 5 iterations if you set up your parameter variation criteria incorrectly.

(Dataset outputs in the experiment's charts are typically for where your model produces a time series as an output --- i.e., a dataset of sim time vs. value --- and you want the Sensitivity Analysis experiment to show charts with each run's time series as separate lines (i.e., time on the X-axis). Scalar charts are for where the X-axis is the varying parameter and the Y-axis the output of interest.)