Skip to content

fix OR node choice variables#10

Merged
haz merged 4 commits intoQuMuLab:masterfrom
symphorien:opposing
Mar 25, 2021
Merged

fix OR node choice variables#10
haz merged 4 commits intoQuMuLab:masterfrom
symphorien:opposing

Conversation

@symphorien
Copy link

  • choice variables are variables (unsigned) not literals (signed)
  • remove conditional in NNF code that becomes redundant based on the
    above
  • fix that literals are translated but not choice variables, which could lead to
    wrong OR node labeling

fixes #9

* choice variables are variables (unsigned) not literals (signed)
* remove conditional in NNF code that becomes redundant based on the
above
* fix that literals are translated but not choice variables, which could lead to
wrong OR node labeling
@haz
Copy link
Contributor

haz commented Mar 19, 2021

Pity we need to resort to the more complex recursive approach, but don't really see any way around it...

There any risk of the choiceVar being unsigned when the keys to the translation are int?

@symphorien
Copy link
Author

There any risk of the choiceVar being unsigned when the keys to the translation are int?

All assignments to choiceVar are visible in the diff, and all of correct type unless I'm mistaken.

if (DT_OR == node->getType())
{
if (node->choiceVar) {
node->choiceVar = varTranslation[node->choiceVar];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's this line I'm concerned with. varTranslation comes in as vector<int>, and while the other instances are int, this one comes in as unsigned.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh indeed ! I had missed this one !
I went all the way and fixed the translation vector to contain unsigned values. i'm fairly confident that it's correct because I can compile sucessfully with -Wsign-promo -Wsign-conversion -Wsign-compare -Werror

@haz
Copy link
Contributor

haz commented Mar 24, 2021

Looks much better now, thanks!

I've never introspected what was being stored on the decision nodes. You happy with half of em coming back with 0 as an entry?

out-br

That's what's generated with this CNF:

p cnf 4 3
2 0
1 3 0
-1 4 0

@symphorien
Copy link
Author

Unfortunately, no, I really need all OR nodes to be indexed with a decision variable.

@haz
Copy link
Contributor

haz commented Mar 24, 2021

Hrmz...then I think the node merging done during simplification needs to be modified to retain the correct decision node (parent rather than child). Is it fine for having only one reason for determinism? E.g., Or(And(1, 2), And(-1, -2)) could come from branching on either 1 or 2.

@symphorien
Copy link
Author

One reason is fine by me if it respect priority variables: if 1 is priority and 2 is not, 1 should be retained.

@haz
Copy link
Contributor

haz commented Mar 24, 2021

Looks like it's not the merger, but the other places where Or nodes are created (I've identified 5 spots). Will give it a go over lunch (hour or two).

@haz
Copy link
Contributor

haz commented Mar 24, 2021

@symphorien Can you give me push access to your fork? I have a set of changes to push.

Btw, this is what we should be able to generate now (same example as above):
out

@symphorien
Copy link
Author

I think I have already ticked the box
image

@haz
Copy link
Contributor

haz commented Mar 25, 2021

Might need to add me as a maintainer on the repo. This is what I'm getting:

$ git push symphorien HEAD:opposing
remote: Permission to symphorien/dsharp.git denied to haz.
fatal: unable to access 'https://github.com/symphorien/dsharp/': The requested URL returned error: 403

@symphorien
Copy link
Author

I invited you, then :)

@haz
Copy link
Contributor

haz commented Mar 25, 2021

Thanks! That seemed to do the trick. How's e76dbc1 look?

@symphorien
Copy link
Author

It passes my tests, and the diff looks good :)

@haz haz merged commit 38dfcfa into QuMuLab:master Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question about unlabeled OR nodes

2 participants