Exception after deleting DAN node and clicking on Strategy button

Create issue
Issue #195 resolved
Manuel Luque created an issue

When the user deletes the node D1 of this decision analysis network (DAN) and then clicks on the button S (Straregy), then there is a NullPointerException: "D1 not found in network DAN-unordered-three-decs-no-chance.pgmx".

The problem appears even after saving the network. However, if the user saves the network, closes it and reopen it, then the problem doesn't appear.

I think the problem is because the InferenceAlgorithm object managed by the GUI should be created again when the network has been modified and before invoking again the method getOptimalStrategy().

I attach a network to reproduce the bug.

Comments (6)

  1. Miguel Ángel Artaso Landa

    I have not been able to reproduce the error. The steps I have followed are:

    1. Open the network.
    2. Right click on node D1 (I have tried also in different tests with D and D2) and remove it
    3. Click on the button S (Straregy), and then the Strategy is shown.

    However, I have noticed the following behavior:

    1. Open the network.
    2. Click on the button S (Straregy), and then the Strategy is shown.
    3. Close the Strategy window.
    4. Right click on any decision node and remove it
    5. Click on S button, and then the Strategy still shows the already removed decision node.
    6. Saving the network and clicking again in the S button shows again the removed decision node.
    7. Closing and opening the network, shows the correct Strategy.

    Should I close this issue and open a new one? Or should I try to find the solution to this problem and post it in this one?

  2. Miguel Ángel Artaso Landa

    Changed the 'showOptimalStrategy' method in the class 'MainPanelListenerAssistant' in the package 'org.openmarkov.core.gui.window'.

    When the strategy was calculated for a network, then, if the network was modified, the strategy was not updated. The reason is that the algorithm, VariableEliminationDAN, was in 'postresolution' mode. Thus, the new strategywas not being calculated. Now, if the network is modified, we set the algorithm to null, as when the mode is changed from inference to edition.

  3. Log in to comment