SoarGroup / VisualSoar

VisualSoar is a development environment written in Java to aid in the creation of agents for use in Soar
6 stars 6 forks source link

Generate Datamap trashes the datamap #28

Open PLatCIC opened 4 months ago

PLatCIC commented 4 months ago

I have a Visual Soar project with a few operators and some complex data structures. I worked hard to build the datamap by hand. Then I thought the automatic DM generation might find some things I missed, so I tried the Generate the Datamap from the Current Operator Hierarchy button. It made a long list of changes. Then when I looked with Display Top-State Datamap, I saw that it had severely trashed the datamap I had so carefully built by hand.

For example, on the top state there is an identifier ships and under it one called ship. Under ship there are a bunch of integer and string attributes. I had copied as a link the ships structure under several of the operators. It was still there as before, but now there is a new ship identifier under several of them that has all those attributes turned into identifiers. Similarly, there is a qna-query structure under io.output-link that was copied as a link under some of the operators. Now its sub-identifier query is copied on to the top level of the operator with its parts messed up.

To help document this, I'm attaching three files. ships-qna.zip has the whole project as it was before doing the automatic datamap generation. Then there are two versions of the .dm file, the one with -1 before the problem and the one with -2 after the problem. Both have .txt added to their names so that GitHub will accept them. It is obvious that the differences are enormous.

ships-qna-1.dm.txt ships-qna-2.dm.txt

It would be nice to have Visual Soar's help with building a datamap, but until this is fixed I will avoid using those features.

johnlaird commented 4 months ago

A few observations:

  1. It did add ships_db to the input-link.qna-registry because you had ships-db by mistake. There are others that it seemed to correctly add.
  2. I'm not sure that I'd say it trashed your data-map. I don't see where it removed any. Maybe I missed that.
  3. It looks like query did not have all the correct values and it added some.
  4. It correctly added the add-target operator.
  5. That operator add-target has a ^ship attribute. No question it shouldn't be added to all operators, but that is why you have it.
  6. Similarly, the register-ship operator has ^query as an attribute, which is why it got added to your operators. VS has trouble with ^operator because it is treated in weird ways in VS. The auto add doesn't know which operator dm entry to add the attributes to (not smart enough to look at the name attribute). (you rename it from qna-query in the condition to query in the action).

So I'm not sure all of the problems you listed are the fault of VS. I think "trashed" is a bit over the top. I think it 10 minutes, you can delete those that you don't want and move on. I highly recommend using the datamap throughout the creation of a project instead of writing lots of rules and then doing the datamap. It is much more helpful as you are writing code.