containers.lp
No OneTemporary

File Metadata

Created
Wed, Jul 8, 1:37 AM

containers.lp

%1. Domain definitions:
impl(solid; on_the_fly; linked_list).
op(seqaccess; randaccess).
relation(recommends; satisfied; unsupported).
relation_score(satisfied, 0).
relation_score(recommends, 1).
score(0..1).
%2. Domain facts:
relation_op(seqaccess, on_the_fly, recommends).
relation_op(randaccess, solid, recommends).
relation_op(randaccess, on_the_fly, unsupported).
bind(X, impl(solid)):- bind(X, dfa_operator(list)).
bind(X, impl(on_the_fly)):- bind(X, dfa_operator(list)).
bind(X, l0_op(seqaccess)) :- bind(X, dfa_operator(loop_fold)).
bind(X, l0_op0(randaccess)) :- bind(X, dfa_operator(index)).
%5. Manual input
%2. Supplies
%4. Best implemetation search:
score(op(OP), IMPL, SCORE):- SCORE = #sum{SCORE1, SCORE1: relation_score(RL, SCORE1), relation_op(OP, IMPL, RL)}; op(OP); impl(IMPL); not relation_op(OP, IMPL, unsupported).
{score(v(VAR), IMPL, SCORE)}:- score(op(OP), IMPL, SCORE); bind(VAR, op(OP)); bind(VAR, impl(IMPL)).
:- 2{score(v(VAR), IMPL, SCORE): v(VAR)}.
#maximize { SCORE, (VAR, SCORE): score(v(VAR), _, SCORE) }.
%5. Output
bind_decision(VAR, SUBJECT, RESOLUTION) :- SUBJECT=implementation; RESOLUTION=IMPL; score(v(VAR), IMPL, _).
%1. DFA input
v(a).
bind(a, dfa_operator(list)).
bind(a, dfa_operator(loop_fold)).

Event Timeline