How to create one Comparison Sample record

A place for Ventity software questions & answers
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Thanks for your help here. I really appreciate it.

This is terribly difficult to do, bug prone, and brittle due to complexity. Even once we solve it here in voter Support Decision, we encounter the same problem in country Choose Election Winner. Thus, we have encountered the strong (?) need for something like “ANY” for Value to Match in a reference for Process List.

With “ANY”, Support Decision is extremely easy to implement with a single Process List call. Using Belief Meme [Country, Politician, Voter], we add a reference using “ANY” for Voter, sort descending on average attractiveness, max to process 1. The first record is the most attractive politician.

The pattern is: What is the max (descending) or min (ascending) of an aggregate function in a partitioned collection, for the partition of interest? Real people make decisions using this pattern.

I don’t know for sure, but I expect to encounter this pattern at least several more times as I build the model out. For example in the model, politicians will be trying to maximize the number of supporters with various deception or truth strategies.

Is Ventity’s design frozen? Is this a possible modification? I think it would make Ventity significantly more versatile and powerful.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Thinking a little more on this, there’s an easier way to implement this than use of “ANY”. Ventity already has a programming call to create the columns and rows for each listing in Entity Types. This is how Results / Edit / View Data creates a spreadsheet with tabs for all entities and subcollections. We just need a way to use that programming call in Process List on a subcollection.

(1) One way to do this is when adding a reference for a Process List, there is now a checkbox for No Values to Match. The default is not checked, which is the way it works now. If No Values to Match is checked, then the Conditions for the partitions are not shown, and the subcollection behaves just like an entity in the Process List. There the filter can reduce the subcollection to just what’s needed. In the case of action Support Decision, this would be filtering Belief Meme [Country, Politician, Voter] on desired Country and Voter.

(2) A second way to do this is to have all subcollections in the list of Collections to Process in Process List. I remember I was surprised when I discovered this list did not include subcollections.

Currently, use of subcollections is limited to setting conditions for all partitions. This is quite limiting. The above two options remove this limit entirely. Now subcollections have the same flexibility as entities. Just an idea!
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Very good news. I worked on this and have what appears to be Support Decision working correctly. It uses Politician Comparison. Voters no longer all choose P1 for supported politician, which was wrong.

I still have to go over and over the data to be sure it’s working correctly, but I wanted to let you know right now, so you can save some time. Muchas gracias!
Attachments
RDem3.zip
(265.99 KiB) Downloaded 291 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

Jack Harich wrote: Tue Mar 21, 2023 3:05 am The pattern is: What is the max (descending) or min (ascending) of an aggregate function in a partitioned collection, for the partition of interest?
The limiting factor is that Process List can't access the subcollection aggregates; it can only iterate over the members. That necessitates copying the value out to an ordinary entity, as you discovered with the Comparisons. I've ticketed this for a future enhancement.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Thanks for the explanation of what’s the limiting factor. Looking forward to the enhancement!

Lo and behold, I’ve encountered more errors. I’m implementing country action Reset Politician Supporters to Zero. If the action is a Command, no errors. But as soon as I set it to Process List on collection Politician, I get two mysterious errors:

Operator '!' cannot be applied to operand of type 'string' (context: initializing; action invocation, in action_reset_politician_supporters_to_zero_country)
The variable 'isEmpty' is assigned but its value is never used (context: initializing; action invocation, in action_sample_media_memes_voter)
Attachments
RDem3.zip
(268.43 KiB) Downloaded 304 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

I think the problem here is that, in the offending action, the Collection To Process=Invoker.Politician, but Invoker.Politician is not a collection.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Thanks Tom, my mistake. Still having trouble thinking in Ventity's terms. Let's see if I can do a tad better!
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Another challenge. In country action Accumulate One Supporter, I’m getting the error “Unexpected character '●' (context: initializing Attributes; trigger "Accumulate One Supporter" invoker for "_invoker.accumulate_one_supporter"., in action_accumulate_number_supporters_country)”

The Process List seems to be setup properly. In fact, it follows the same pattern as seen in voter action Accumulate One Politician Comparison, which works fine. Both do almost the same thing: They use a temp variable to set the value of one entity property, a stock, by incrementing it by one.

Rather than provide a solution, how about if you relate your thinking process. How do you use what’s stated in the documentation, combined with inspection of the model, to determine the error’s cause? This is what I need to learn. Thanks. I really appreciate this.
Attachments
RDem 2.zip
(28.37 KiB) Downloaded 299 times
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Good news, after an exercise walk and thinking fresher, I noticed I was looking at the wrong action. According to the error message, the problem is in action Accumulate Number Supporters. There, using control drag, I changed refVoter (large dot) politician supporter to shadow refVoter.politician supporter and the error vanished.

Where in the documentation is the use of control drag and shadow nodes for use in cases like this explained?

Checking results, I see that country incumbent politician is never set. I will work on that.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

Glad you worked it out - you did exactly what I would have suggested.
Jack Harich wrote: Tue Mar 21, 2023 10:18 pm Where in the documentation is the use of control drag and shadow nodes for use in cases like this explained?
It's right next to the part that explains how to prove the Riemann hypothesis.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Hey Tom, I laughed so hard! Thanks!

I'm now proceeding a lot more smoothly, now that the big decisions based on data are done and I've learned the basics of Ventity, thanks to your gracious help!

To maintain conceptual control of 13 actions so far, I used an action name prefix convention. They are organized into groups like G1, G2. Within each group the actions are sequentially organized in call sequence. Now I can much more quickly figure out what to do when evolving the model. I foresee adding many more actions and several more entities in the stage 1 proof-of-concept model.

G1_3 calls G13A. G1_3 has a lower sequence number than G1_4.

U is for ungrouped. An ungrouped action calls no further actions.

The info in the action names is incomplete. It also needs S for period start, E for period end, or M for model startup, plus sequence number. This is easily provided with a suffix convention. I'm still pondering this. Large bodies of code, even when using a framework like Ventity, can so easily get out of conceptual control unless conventions are used.

I've also created a Test entity, for the purpose of testing tricky equations like this one:
(1 - LTQ) * (1 - AAQ) * Country.effect of inflation on probability of detection((inflation - 1)/Country.inflation point of diminishing returns) + LTQ * AAQ * truthfulness
Attachments
Ventity organization of actions.png
Ventity organization of actions.png (19.76 KiB) Viewed 6161 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

This is cool. It may also be a record for most action-rich model.

The test entity is a good idea. I actually still prototype tough equations in Vensim, because it's quicker to test them in Synthesim. Sometimes Excel is useful too, if you want simultaneous visibility of several cases.
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

Moving forward and appreciating Ventity’s many rich features!

My prediction on how use of DELAY3 (input, delay time) should behave is not working out. A delay time of 10 years is behaving like it’s using 1 year. This puzzling behavior may be seen in the diagrams for Voter and Country-Graphs, for LTQ change and AAQ change. I also tried SMOOTH3, same result. The result tables show that Voter AAQ change and LTQ change occur in one year only, instead of ten years. I’m also expecting a sigmoidal curve.
Attachments
RDem 31.zip
(160.76 KiB) Downloaded 295 times
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

The Voter entity now uses DELAY3 and SMOOTH3. I noticed in action Create Initial Voters that stocks for DELAY3 and SMOOTH3 are automatically added to the diagram as surrogates. I suspect this should not be done for any of the functions implemented as macros. I’ve deleted them from the diagram.

The unnecessary surrogates are:
newVoter (large dot) AAQ change SMOOTH31 Level1
newVoter (large dot) AAQ change SMOOTH31 Level2
newVoter (large dot) AAQ change SMOOTH31 Level3
newVoter (large dot) LTQ change DELAY31 Level 1
newVoter (large dot) LTQ change DELAY31 Level 2
newVoter (large dot) LTQ change DELAY31 Level 3 [END]
Jack Harich
Senior Member
Posts: 68
Joined: Wed Sep 15, 2004 9:01 pm
Vensim version: DSS

Re: How to create one Comparison Sample record

Post by Jack Harich »

A slight bug here. On the Country – Graphs diagram, I’ve changed the name of an auxiliary to “LTQ points rise.” Its slider row now vanishes. Editing the slider will not bring the row back. Even changing to another variable and then changing back to “LTQ points rise” will not bring it back.

I’ve encountered this before. The solution is to delete the slider and start a new one from scratch.
Attachments
RDem 40.zip
(161.7 KiB) Downloaded 315 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

In v31, you have a unit error in the LTQ and AAQ equations. I think the DELAY3 is fine; the flow formulation is acting like a discrete event.

Check the Units manager prefs to be sure checking is on.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How to create one Comparison Sample record

Post by tomfid »

Re v40 - displays fine for me.
Post Reply