diff --git a/problems/example-computations.lp b/problems/example-computations.lp new file mode 100644 index 0000000..762f2db --- /dev/null +++ b/problems/example-computations.lp @@ -0,0 +1,49 @@ +%defines: + implementation(hashlist). implementation(linkedlist). implementation(treelist). implementation(computation). + operation(at). operation(sort). operation(insert). operation(seqaccess). + connection_type(ct_inherits). connection_type(ct_convert). + + relation (recommends). relation (satisfied). relation(unsupported). + relation_score(satisfied, 0). + relation_score(recommends, 1). + relation_score(unsupported, -1). + +%integration facts: + relation_op(seqaccess, computation, recommends). + relation_op(at, hashlist, recommends). relation_op(at,treelist, satisfied). + relation_op(sort, linkedlist, satisfied). relation_op(sort, treelist, satisfied). relation_op(sort, hashlist, unsupported). + + + +%static analysis: + var(a).var(tmp2). var(b). var(tmp3). + + var_connection(a, tmp2). + bind_var_op(tmp2, seqaccess). + var_connection(tmp2, b, ct_inherits). + var_connection(b, tmp3). + bind_var_op(tmp3, seqaccess). + +%domain rules: + impl_fulfill(OP, IMPL, SCORE):- relation_op(OP, IMPL, RL), relation_score(RL, SCORE), operation(OP), implementation(IMPL), RL!=unsupported. + impl_not_fulfill(OP, IMPL):- relation_op(OP, IMPL, unsupported). + +%reasoning rules: + { var_connection(VAR_FROM, VAR_TO, CT):connection_type(CT) }1 :- var_connection(VAR_FROM, VAR_TO). + + var_cluster_root(VAR) :- {var_connection(VAR_F, VAR, ct_inherits): var(VAR_F)} 0, var(VAR). + var_cluster(VAR0, VAR_TO) :- var_connection(VAR0, VAR_TO, ct_inherits), var_cluster_root(VAR0). + var_cluster(VAR0, VAR_TO2) :- var_connection(VAR_TO1, VAR_TO2, ct_inherits), var_cluster(VAR0, VAR_TO1). + var_cluster(VAR0, VAR0):- var_cluster_root(VAR0). + + impl_fulfill_cluster(VAR0, OP, IMPL, SCORE) :- var_cluster(VAR0, VAR_ANY), bind_var_op(VAR_ANY, OP), impl_fulfill(OP, IMPL, SCORE), var_cluster_root(VAR0). + impl_not_fulfill_cluster(VAR0, IMPL):-var_cluster(VAR0, VAR_ANY), bind_var_op(VAR_ANY, OP), impl_not_fulfill(OP, IMPL), var_cluster_root(VAR0). + bind_var_impl(VAR0, IMPL, SCORE_RESULT) :- SCORE_RESULT = #sum[impl_fulfill_cluster(VAR0, _, IMPL, SCORE) = SCORE], {impl_not_fulfill_cluster(VAR0, IMPL)}0, var_cluster_root(VAR0), implementation(IMPL). + +%pretty output: + #hide. + #show chosen_impl/2. + %#show bind_var_impl/3. + %#show var_cluster_owner/1. + %#show var_connection/3. + %#show bind_var_op/2. diff --git a/project/diploma-doc.doc b/project/diploma-doc.doc new file mode 100644 index 0000000..00d6285 Binary files /dev/null and b/project/diploma-doc.doc differ