Skip to content

#= may fail in one direction but not the other #40

@jeshan

Description

@jeshan

I've found a case where A#=B fails while B#=A does not. The issue is more readily observed with a custom propagator:

:- use_module(library(clpz)).

:- multifile clpz:run_propagator/4.

try :-
    A+B #= _,
    clpz:make_propagator(my_propagator(A), Prop),
    clpz:init_propagator(C, Prop),
    clpz:init_propagator(B, Prop),
    % clpz:trigger_once(Prop),
    write(start),
    nl,
    C = 0.                      % nontermination

my_propagator_impl(A, _) :-
    clpz:fd_get(A, _, fd_props(_,[propagator(pplus(_,B_,_),_)],_)), % trying to access the plus constraint created above
    _ #= B_. % swap sides to observe difference

% also this:
clpz:run_propagator(my_propagator(Arg), MState) -->
    { my_propagator_impl(Arg, MState) }.

I run with:

sicstus -l demo.pl --goal "try."

swap _ #= B_ with B_ #= _ to observe that the issue is gone.

What gives? Should I not use #= in a custom propagator?

Also: note that C isn't even useful in this very simplified scenario

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions