I need some consultation on the correctness of the activity diagram, that I have created for the following scene:

I have one dictionary structure, that I want to compare to other dictionaries. for the explanation I want to name them as sentences. So, I am comparing one sentence to other multiple sentences by iterating through them. I am counting the words that match, as bestCount.

Now at first, the very first sentence will be counted as bestDict. then go to the second sentence, and if the bestCount is greater than the previous one, then count the second sentence as bestDict and if not don't change the bestDict, which means the first sentence should be our bestCount.

In case, if there are multiple sentences, which have the same bestCount, for example if our second sentence was selected as bestDict, where bestCount is 5, and our third dictionary also has, 5 bestCount, then I compare the size of these two sentences and select the bestDict, which has the smallest size.

I am doing this for each one till the end. I have created the following diagram, and need some consultation, regarding the correctness of it, to what I have told in the scene.

Thank You.

enter image description here

  • This won't even start at the first action since it needs 2 tokens but gets only one.
    – user188153
    Jan 1 at 0:35
  • I did not understand. It starts with selecting the first sentence as the bestCount, then moves to the second sentence and checks if the bestCount is greater than the previous one, (here, than the first one) and if yes, marks second sentence as the bestDict and then moves to the third sentence. again checks if the bestCount is greater than the previous one (the second one) than marks the third one as bestCount, otherwise, the previous one.Now, if the third one has, the same amount of bestCounts as the second one, then it compares the size of these both, and returns the short one. what is wrong?
    – Hefaz
    Jan 1 at 0:52
  • and apart from this diagram, is it OK to return the shortest one, when comparing the size in case of equal bestCounts? There is no semantic meaning involved at all. just syntactic. I decided to return the shortest one, because it seems less convoluted. but I don't have any proof for that.
    – Hefaz
    Jan 1 at 0:55
  • You need a merge node prior. Without understanding the token concept of ADs and state charts (coming from Petri nets) you fail to create a valid diagram. Further your actions "DictionaryN" are no actions at all. Would someone understand what you try to describe? I would not.
    – user188153
    Jan 1 at 9:45
  1. One problem is the use of ellipses (dot dot dot) at the end, which are not legal notation for such a diagram.
  2. The diagram shown above can get stuck in an infinite loop in the first three nodes, never getting to the third, fourth, etc dictionaries.
  3. The diagram does not process a variable number of dictionaries, but instead spells them out.
  • 1
    The grammatical errors were edited. So, I name all of them as sentences. The number of sentences is not fixed, they can have any length, So how would I do that, without dots? Yes, the questions is exactly that, but not only A,B, and C. there can be many of the them. I hope it is clear now, and I hope I will get some more good suggestions.
    – Hefaz
    Jan 1 at 16:56
  • Thank you. The problem with your current AD is that it seems that it has infinite loops, for example the first three boxes. I think you want a structure like this: (a) designate the first sentence as the best one, after computing its score (b) fetch the next sentence for comparison. If there is no such sentence, exit, and your answer is in your "best" variable. Otherwise, compute its score and if it is better than the score of the current best, replace the "best" with the current one (c) go back to (b). This structure visits all your sentences and finds the best one.
    – Mr. Lynch
    Jan 1 at 21:30
  • Ok. how would you draw your solution? you are still talking about a,b and c. why do you go back to b? I am not computing score of the best sentence at first run, I just select that as best, and I do not fetch next sentence, I iterate through it. I am still confused about the loops. why do you say that? how would you do that if you have a very big number of sentences?
    – Hefaz
    Jan 2 at 5:22
  • No. 1 should be: the first action will never start since it needs 2 tokens but only gets one.
    – user188153
    Jan 7 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.