Skip to content

Incremental, but isolated grounding #613

@samutoljamo

Description

@samutoljamo

With gringo binary, it is possible to ground a program separately and use that as context while invoking Clingo. I.e. see the following programs:

% base.lp
% contains lots of rules and facts

% program1
% small program, creates typically a projection of the answer set, but not limited in any way

% program2
% small program, creates typically  a projection of the answer set, but no limited in any way

With the binaries, I can first ground base.lp, save that to a file and then invoke Clingo first for program1 and secondly for program2.

However, it seems to me that this behaviour is not possible using the C/C++ API. Is this indeed the case and will this be possible in Clingo 6?

Multi-shot solving / incremental grounding are not applicable, since the programs should be isolated. In our case, using externals to scope out the non-wanted programs won't also work. Creating a copy of the control object after grounding the base programs seems to be not possible. Forking the process may be possible, but seems like a hack rather than a solution.

I am aware of load_aspif, but would prefer avoiding file operations. Also, for larger programs, I am not sure if this would be possible via grounding observer API, but even if it is, it seems inefficient for the purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions