Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug2 in Recursive Symbolic Constraints #59

Open
VeraZhang0311 opened this issue May 29, 2024 · 1 comment
Open

Bug2 in Recursive Symbolic Constraints #59

VeraZhang0311 opened this issue May 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@VeraZhang0311
Copy link
Collaborator

VeraZhang0311 commented May 29, 2024

I tested Formula to find a solution with 3 cycles:

domain Graph
{
  Node ::= new (id: Integer).
  Edge ::= new (src: Integer, dst: Integer).

  edgeHasSrc ::= (src: Integer).
  edgeHasDst ::= (dst: Integer).

  path ::= (Integer, Integer).
  cycle ::= (Integer).

  badSrc ::= (src: Integer).
  badDst ::= (dst: Integer).

  edgeHasSrc(a) :- Edge(a, b), Node(a).
  edgeHasDst(b) :- Edge(a, b), Node(b).

  badSrc(a) :- Edge(a, b), no edgeHasSrc(a).
  badDst(b) :- Edge(a, b), no edgeHasDst(b).

  path(a, b) :- Edge(a, b).
  path(a, c) :- path(a, b), path(b, c).
  cycle(a) :- path(a, a).

  conforms no badSrc(_).
  conforms no badDst(_).

  enoughNodes :- count({ n | n is Node(_)}) > 1. 
  conforms enoughNodes.

  enoughEdges :- count({ e | e is Edge(_, _)}) > 3. 
  conforms enoughEdges.

  enoughCycles :- count({ c | c is cycle(_)}) = 3.
  conforms enoughCycles.
}

partial model pm of Graph
[solver_RecursionBound = 10]
{
  Node(t).
  Node(u).
  Node(v).
  Edge(l, m).
  Edge(n, o).
  Edge(p, q).
  Edge(r, s).
}

The (incorrect) solution to the partial model is:

Node(7)
Node(8)
Node(9)
Edge(7, 7)
Edge(8, 8)
Edge(8, 7)
Edge(9, 7)

which shouldn't have a cycle(9) but Formula indicates it does.

@VeraZhang0311 VeraZhang0311 added the bug Something isn't working label May 29, 2024
@balasub
Copy link

balasub commented May 30, 2024

Potential fix in e67da65. Needs testing. Note that setting [solver_RecursionBound = 10] is probably a bit high. It's faster to test with [solver_RecursionBound = 5].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants