xsb is too slow

Issue #388 resolved
Bart Bogaerts created an issue

On the attached file, using xsb to calculate definitions is slower than without xsb..

Comments (4)

  1. Bart Bogaerts reporter

    Note: the definition here is very "inefficient" (because of the negation), but still, xsb should not be slower than ground&solve i guess ...

  2. Joachim Jansen

    The slow is caused by conversion from ~? to !~

    XSB will generate all combinations of 4 companies and check whether for all these instances it holds that they are not controlled by some company.

    The transformed definition is the following:

    :- set_prolog_flag(unknown, fail).
    :- table idpxsb4139_uncontrolled/1.
    idpxsb4139_uncontrolled(IDPXSBc) :- idpxsb4141_temp24(IDPXSBc), idpxsb6_Company(IDPXSBc).
    idpxsb4140_temp25(IDPXSBx, IDPXSBu, IDPXSBy, IDPXSBz) :- idpxsb6_Company(IDPXSBz), idpxsb6_Company(IDPXSBy), idpxsb6_Company(IDPXSBu), idpxsb6_Company(IDPXSBx).
    idpxsb4141_temp24(IDPXSBc) :- idpxsb6_Company(IDPXSBc), forall(idpxsb4140_temp25(IDPXSBx, IDPXSBu, IDPXSBy, IDPXSBz), (\+ idpxsb4138_controlledx95xby(IDPXSBc, IDPXSBx, IDPXSBy, IDPXSBz, IDPXSBu))).
    
  3. Joachim Jansen

    Optimised handling of rules of the form (p(x) <- ~?y : q(x,y))

    Pushing down negations will result in !y : ~q(x,y) as rule body. However, this is a less efficient form.

    This change implements a check whether there is directly a negation after the forall and if so, presents a simpler Prolog rule (one without forall/2).

    This fixes issue #388

    → <<cset b1ffd2267348>>

  4. Log in to comment