• Keine Ergebnisse gefunden

Stepwise optimization of a constraint logic program for the computation of ranking functions

N/A
N/A
Protected

Academic year: 2022

Aktie "Stepwise optimization of a constraint logic program for the computation of ranking functions"

Copied!
20
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Deklarative Modellierung und effiziente Optimierung (MOC 2012)

Ulrich Geske1, Armin Wolf2

1Universität Potsdam, 2Fraunhofer FIRST, Berlin Ulrich.Geske@uni-potsdam.de, Armin.Wolf@first.fraunhofer.de

Vorwort zum Workshop

"Deklarative Modellierung und effiziente Optimierung" (MOC 2012)

Ziel der Workshop-Reihe

Die Workshop-Reihe Deklarative Modellierung und effiziente Optimierung zielt insbesondere auf die Anwendung und Weiterentwicklung von Constraint-Technologien sowie auf die Verbindung bzw. Gegenüberstellung dieses Paradigmas mit anderen Optimierungsverfahren. Konkrete Themen, die für den Workshop eine Rolle spielen sind deshalb einerseits die constraint-basierte Modellierung und Lösung von Anwendungsproblemen, u.a. für die Werkstatt- und Materialbedarfsplanung, das Flottenmanagement und die Fahrplanoptimierung, Personal- und Stundenplanung, Variantenkonfiguration technischer Anlagen aber auch deren Software, die Optimierung verteilter Berechnungs- oder Geschäftsprozesse sowie die Lastverteilung, als auch andererseits die Implementierung von Constraint-Modellen, u.a. durch die Verwendung unterschiedlicher Constraint-Systeme, die Erweiterung von Konsistenztechniken, effiziente Suchverfahren, Nachweis der Optimalität, Visualisierung des Lösungsprozesse, inkrementelle Lösungsanpassung u.a. in Verbindung mit anderen Optimierungstechniken. Die für diesen Workshop akzeptierten Arbeiten demonstrieren einige der unterschiedlichen Aspekte des Workshop-Themas.

Beiträge zum diesjährigen Workshop

Der diesjährige Workshop zeigt anhand zweier Arbeiten die Spannbreite der Thematik.

Zum einen wird untersucht, wie ein als klassisch zu bezeichnendes Problem einer Scheduling-Aufgabe durch innovative Anwendung bekannter Konstrukte der Constraint-Programmierung gelöst werden kann. Zum anderen wird versucht, sich einer bisher nicht behandelbare verbale Anforderung an die zu findende Lösung mit Hilfe bekannter Techniken der Constraint-Programmierung approximativ zu nähern.

(2)

Die Arbeit von Anna Prenzel und Georg Ringwelski „Statistical Evaluation of the Usability of Decision-Oriented Graphical Interfaces in Scheduling Applications“. Darin wird untersucht, wie sowohl die Qualität der Lösung als auch die Erfolgsquote der Lösungsfindung durch Kombination eines automatischen Ablaufs mit interaktiver Einflussnahme verbessert werden kann. Der Vorteil der Interaktivität liegt auch darin, dass nicht explizit formulierte oder nicht formulierbare Randbedingungen noch berücksichtigt werden können. Die Art und Weise der Kombination von automatischer und interaktiver Lösungsfindung liegt im Fokus der vorliegenden Arbeit.

Christoph Beierle, Gabriele Kern-Isberner und Karl Södler beschreiben in der Arbeit

„Stepwise Optimization af a Constraint Logic Program for the Computation of Ranking Functions“ die Behandlung vager Bedingungen der Form „wenn A, dann normalerweise B“. Derartige Anforderungen werden z. B. bei der Realisierung intelligenter Agenten und deren Aktionen auf eventuell unvollständig erfasste Umgebungszustände erforderlich. Die Autoren beschreiben die Modellierung des Problems als Constraint- Programm, das zur Lösung mehrfache Optimierungsschritte erfordert. Im Zusammenhang mit dem Optimierungsprozess stellt sich die Frage nach der Effizienz, die u.a. durch verschiedene Benchmarks untersucht wird. Die Darstellung und Kommentierung des erforderlichen Programmcodes macht die Problembehandlung transparent.

Danksagung

Für die Unterstützung bei der Organisation und Durchführung des nunmehr fünften Workshops dieser Serie danken wir dem Programmkomitee und den externen Gutachtern, die insbesondere durch die Begutachtung der eingereichten Beiträge und die Unterstützung der Autoren durch Hinweise zu ihren Arbeiten zum Gelingen beigetragen haben: Christoph Beierle, FernUniversität Hagen; Stephan Frank, TU Berlin; Hans- Joachim Goltz, Fraunhofer FIRST, Berlin; Petra Hofstedt, Brandenburgische Technische Universität Cottbus; Walter Hower, Hochschule Albstadt-Sigmaringen; Ulrich John, SIR Dr. John UG, Berlin; Georg Ringwelski, Hochschule Zittau/Görlitz; Dietmar Seipel, Universität Würzburg.

Berlin, im Juni 2012

Ulrich Geske und Armin Wolf

(3)

Stepwise Optimization of a Constraint Logic Program for the Computation of Ranking Functions

Christoph Beierle1, Gabriele Kern-Isberner2, Karl S¨odler1

1Dept. of Computer Science, FernUniversit¨at in Hagen, 58084 Hagen, Germany

2Dept. of Computer Science, TU Dortmund, 44221 Dortmund, Germany Abstract:Ordinal conditional functions (OCFs) can be used for assigning a seman- tics to qualitative conditionals of the formifAthen (normally)B. The set of OCFs accepting all conditionals in a knowledge baseRcan be specified as the solutions of a constraint satisfaction problemCR(R). In this paper, we present three optimizations of a high-level, declarative CLP program solvingCR(R)and illustrate the benefits of these optimizations by various examples.

1 Introduction

Common sense knowledge like “birds are animals” or “birds fly” can be expressed as conditionals of the form “if Athen (normally) B”, formally denoted by (B|A). Such conditionals are very different from material implicationsA⇒B, and their semantics is often given by what can be seen as an epistemic state of an intelligent agent. In this paper, we consider Spohn’s ordinal conditional functions (OCF) [Spo88] providing a semantics for qualitative conditionals. Given a knowledge baseR={R1, . . . , Rn}of conditionals, we are interested in determining all OCFs that on the one hand acceptR, and that on the other hand, are as unspecific as possible. While for system Z [GMP93, GP96] a unique most unspecific OCF exists, here we consider the framework of c-representations [KI02]

that has been developed as a qualitative realization of the ideas underlying the probabilistic maximum entropy principle [Par94, PV97, KI98] and provides a generalization of system Z* [GMP93].

In [BKI11], as a challenge for constraint programming, the set of all c-representations acceptingRis specified via the set of solution vectors of a finite domain constraint satis- faction problemCR(R). For computing the solutions ofCR(R), in [BKS11, BKS12] a high-level, declarative CLP programGenOCFis developed. In this paper, we extend the work in [BKS11, BKS12] by developing three optimizationsCR(R)andGenOCF:

• We optimizeCR(R)by replacing inequations inCR(R)by equations such that no minimal solutions are lost (Sec. 4). This optimizations is motivated by the fact that one is mainly interested in minimal solutions ofCR(R).

The research reported here was partially supported by the Deutsche Forschungsgemeinschaft – DFG (grants BE 1700/7-2 and KE 1413/2-2).

(4)

• We optimizeGenOCF by simplifying minimum constraints over a sum of terms containing a 0 (Sec. 5). This optimization is possible since all solution values are non-negative.

• Finally, we further reduce the number of minimum constraints over a sum of terms by considering multiple terms and subterms (Sec. 6).

Before presenting the optimizations in detail, we recall the OCF background (Sec. 2) and the the basics ofCR(R)andGenOCF(Sec. 3) as far as is needed here. In Section 7, a first implementation of the different optimizations are evluated with respect to various examples, and Section 8 concludes and points out further work.

2 Background

We start with a propositional languageL, generated by a finite setΣof atomsa, b, c, . . ..

The formulas ofLwill be denoted by uppercase Roman lettersA, B, C, . . .. For concise- ness of notation, we will omit the logicaland-connective, writingABinstead ofA∧B, and overlining formulas will indicate negation, i.e.Ameans¬A. LetΩdenote the set of possible worlds overL;Ωwill be taken here simply as the set of all propositional interpre- tations overLand can be identified with the set of all complete conjunctions overΣ. For ω∈Ω,ω|=Ameans that the propositional formulaA∈ Lholds in the possible worldω.

By introducing a new binary operator|, we obtain the set(L | L) ={(B|A)|A, B∈ L}

ofconditionalsoverL.(B|A)formalizes “ifAthen (normally)B” and establishes a plau- sible, probable, possible etc connection between theantecedentAand theconsequence B. Here, conditionals are supposed not to be nested, that is, antecedent and consequent of a conditional will be propositional formulas. A conditional(B|A)is an object of a three- valued nature, partitioning the set of worldsΩin three parts: those worlds satisfyingAB, thusverifyingthe conditional, those worlds satisfyingAB, thusfalsifyingthe conditional, and those worlds not fulfilling the premiseAand so which the conditional may not be applied to at all. This allows us to represent(B|A)as ageneralized indicator function going back to [DeF74] (whereustands forunknownorindeterminate):

(B|A)(ω) =

1 if ω|=AB 0 if ω|=AB u if ω|=A

(1)

To give appropriate semantics to conditionals, they are usually considered within richer structures such asepistemic states. Besides certain (logical) knowledge, epistemic states also allow the representation of preferences, beliefs, assumptions of an intelligent agent.

Basically, an epistemic state allows one to compare formulas or worlds with respect to plausibility, possibility, necessity, probability, etc.

Well-known qualitative, ordinal approaches to represent epistemic states are Spohn’sordi- nal conditional functions, OCFs, (also calledranking functions) [Spo88], andpossibility distributions[BDP92], assigning degrees of plausibility, or of possibility, respectively, to

(5)

ω κ1(ω) κ2(ω) κ3(ω)

f ba 0 0 0

f ba 1 1 1

f ba 0 0 0

f ba 0 0 0

ω κ1(ω) κ2(ω) κ3(ω)

f ba 1 1 2

f ba 1 2 1

f ba 0 0 0

f ba 0 0 0

Figure 1: Different ranking functionκiaccepting the rule setRbirdsgiven in Example 1

formulas and possible worlds. In such qualitative frameworks, a conditional(B|A)is valid (oraccepted), if its confirmation,AB, is more plausible, possible, etc. than its refutation, AB; a suitable degree of acceptance is calculated from the degrees associated withAB andAB.

In this paper, we consider Spohn’s OCFs [Spo88]. An OCF is a functionκ : Ω → N expressing degrees of plausibility of propositional formulas where a higher degree denotes

“less plausible” or “more suprising”. At least one world must be regarded as being normal;

therefore,κ(ω) = 0for at least oneω ∈Ω. Each such ranking function can be taken as the representation of a full epistemic state of an agent. Each suchκuniquely extends to a function (also denoted byκ) mapping sentences and rules toN∪ {∞}and being defined by

κ(A) =

(min{κ(ω)|ω|=A} ifAis satisfiable

∞ otherwise (2)

for sentencesA∈ Land by κ((B|A)) =

(κ(AB)−κ(A) ifκ(A)6=∞

∞ otherwise (3)

for conditionals(B|A) ∈ (L | L). Note thatκ((B|A))> 0since anyωsatisfyingAB also satisfiesAand thereforeκ(AB)>κ(A). The belief of an agent being in epistemic stateκwith respect to a default rule(B|A)is determined by the satisfaction relation |=O given by:

κ|=O(B|A) iff κ(AB) < κ(AB) (4) Thus, (B|A)is believed in κ iff the rank of AB (verifying the conditional) is strictly smaller than the rank ofAB(falsifying the conditional). We say thatκacceptsthe condi- tional(B|A)iffκ|=O(B|A).

Given a knowledge baseR = {R1, . . . , Rn}of conditionals, a ranking functionκthat accepts everyRirepesents an epistemic state of an agent acceptingR. If there is noκthat accepts everyRi thenRisinconsistent. For the rest of this paper, we assume thatRis consistent.

For any consistentRthere may be many differentκaccepting R, each representing a complete set of beliefs with respect to every possible formulaAand every conditional (B|A).

(6)

Example 1 LetRbirds={R1, R2, R3}be the following set of conditionals:

R1: (f|b) birds fly

R2: (a|b) birds are animals R3: (a|f b) flying birds are animals

In Figure 1, three different OCFsκ123 acceptingRbirds are given. Thus, for any i∈ {1,2,3}andj ∈ {1,2,3}it holds thatκi|=ORj. In order to ilustrate the evaluation of beliefs, consider the conditional(a|bf)(“Are non-flying birds animals?”) that is not contained inR. Forκ3, we getκ3(abf) = 2andκ3(abf) = 1and thereforeκ3|=/O(a|bf) so that the conditional(a|bf)is not accepted byκ3. On the other hand, forκ2 we get κ2(abf) = 1andκ2(abf) = 2and thereforeκ2|=O(a|bf).

The full beliefs about non-flying birds being animals or not, represented by the condition- als(a|bf)and(a|bf), are given by the following table:

κ1|=/O(a|bf) κ2|=O(a|bf) κ3|=/O(a|bf) κ1|=/O(a|bf) κ2|=/O(a|bf) κ3|=O(a|bf)

An agent being in epistemic stateκ2believes that non-flying birds are animals and does not believe that non-flying birds are not animals. An agent being in epistemic stateκ3

does not believe that non-flying birds are animals and believes that non-flying birds are not animals. An agent being in epistemic stateκ1is completely indifferent with respect to non-flying birds being animals or not, since she considers a world where non-flying birds are animals as equally plausible (or equally surprising) as a world where non-flying birds are not animals.

Thus, Example 1 illustrates that every OCFκaccepting a knowledge baseRinductively completes the knowledge given byR, and that in general there are different ways of com- pleting the knowledge. In principle, one is interested in characterizing and determining the full set of accepting OCFs, and it is a crucial question whether someκis to be preferred to some otherκ, or whether among the preferred ones there is a unique “best”κ.

3 Computing OCFs as Solutions of a Constraint Satisfaction Problem

3.1 The Constraint Satisfaction ProblemCR(R)

Different ways of determining a ranking function for a knowledge baseRare given by system Z [GMP93, GP96] or its more sophisticated extension system Z [GMP93], see also [BP99]; for an approach using rational world rankings see [Wey98]. For quantitative knowledge bases of the formRx = {(B1|A1)[x1], . . . ,(Bn|An)[xn]} with probability valuesxiand with models being probability distributionsPsatisfying a probabilistic con- ditional(Bi|Ai)[xi] iffP(Bi|Ai) = xi, a unique model can be choosen by employing the principle of maximum entropy [Par94, PV97, KI98]; the maximum entropy model is a best model in the sense that it is the most unbiased one among all models satisfyingRx.

(7)

Using the maximum entropy idea, in [KI02] a generalization of system Zis suggested.

Based on an algebraic treatment of conditionals, the notion ofconditional indifferenceof κwith respect toRis defined and the following criterion for conditional indifference is given: An OCFκis indifferent with respect toR={(B1|A1), . . . ,(Bn|An)}iffκ(Ai)<

∞for alli∈ {1, . . . , n}and there are rational numbersκ0, κ+i , κi ∈Q, 16i6n,such that for allω∈Ω,

κ(ω) =κ0+ X

16i6n ω|=AiBi

κ+i + X

16i6n ω|=AiBi

κi . (5)

When starting with an epistemic state of complete ignorance (i.e., each worldωhas rank 0), for each rule(Bi|Ai)the values κ+i , κi determine how the rank of each satisfying world and of each falsifying world, respectively, should be changed:

• If the worldωverifies the conditional(Bi|Ai), – i.e.,ω |=AiBi –, thenκ+i is used in the summation to obtain the valueκ(ω).

• Likewise, ifωfalsifies the conditional(Bi|Ai), – i.e.,ω |=AiBi –, thenκi is used in the summation instead.

• If the conditional(Bi|Ai)is not applicable inω, – i.e., ω |= Ai –, then this conditional does not influence the valueκ(ω).

κ0is a normalization constant ensuring that there is a smallest world rank 0. Employing the postulate that the ranks of a satisfying world should not be changed and requiring that changing the rank of a falsifying world may not result in an increase of the world’s plausibility leads to the concept of ac-representation[KI02, KI01]: Any ranking function κsatisfying the conditional indifference condition (5) andκ+i = 0,κi >0(and thus also κ0= 0sinceRis assumed to be consistent) as well as

κ(AiBi)< κ(AiBi) (6) for all i ∈ {1, . . . , n} is called a (special) c-representation of R. Note that for i ∈ {1, . . . , n}, condition (6) expresses that κaccepts the conditional Ri = (Bi|Ai) ∈ R (cf. the definition of the satisfaction relation in (4)) and that this also impliesκ(Ai)<∞.

Thus, finding a c-representation forRamounts to choosing appropriate valuesκ1, . . . , κn. In [BKS12] this situation is formulated as a constraint satisfaction problemCR(R) whose solutions are vectors of the form(κ1, . . . , κn)determining c-representations ofR.

The formulation ofCR(R)requires that theκi are natural numbers (and not just rational numbers) and thatmin(∅) =∞.

Definition 2 [CR(R)[BKS12]] LetR = {(B1|A1), . . . ,(Bn|An)}. The constraint satisfaction problem for c-representations ofR, denoted byCR(R), is given by the con- junction of the constraints, for alli∈ {1, . . . , n}:

κi >0 (7)

κi > min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj − min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj (8)

(8)

A solution ofCR(R)is ann-tupel(κ1, . . . , κn)of natural numbers, and withSolCR(R) we denote the set of all solutions ofCR(R).

Proposition 3 [BKS12] ForR = {(B1|A1), . . . ,(Bn|An)} let #»κ = (κ1, . . . , κn) ∈ SolCR(R). Then the functionκdefined by (9) and denoted byκκ, is an OCF that accepts R:

κ(ω) = X

16i6n ω|=AiBi

κi (9)

Example 4 LetRbirds={R1, R2, R3}be as in Example 1. From (8) we get κ1 >0,

κ2 >0−min{κ1, κ3}, κ3 >0−κ2

and sinceκi >0according to (7), the two vectors

sol1= (κ1, κ2, κ3) = (1,0,1) sol2= (κ1, κ2, κ3) = (1,1,0)

are two different solutions ofCR(Rbirds). The OCFκsol1 (resp. κsol2) induced bysol1 (resp.sol2) according to (9) isκ1(resp.κ2) as given in Example 1.

3.2 The CLP programGenOCF

In GenOCF [BKS12] a knowledge base R = {(B1|A1), . . . ,(Bn|An)} is given as a Prolog code file providing the predicates variables/1, indices/1 and conditional/3. If Σ = {a1, . . . , am} is the set of atoms, we assume a fixed or- deringa1< a2< . . . < amonΣgiven by the predicatevariables([a1,...,am]).

The fixed index ordering given byindices([1,...,n])ensures that the condition- als are ordered consecutively from 1 to n. Thus, the i-th conditional can be accessed byconditional(i,A,B), and in a solution vector[K1,...,Kn], thei-th compo- nentKi is theκ-value for thei-th conditional. In the representation of a conditional, a propositional formulaA, constituting the antecedent or the consequence of the condi- tional, is represented byhAiwherehAiis a Prolog list[hD1i,...,hDli]. EachhDii represents a conjunction of literals such thatD1∨. . .∨Dlis a disjunctive normal form ofA. EachhDi, representing a conjunction of literals, is a Prolog list[b1,...,bm]of fixed lengthmwheremis the number of atoms inΣand withbk∈ {0, 1, _}. Such a list[b1,...,bm]represents the conjunctions of atoms obtained froma˙1∧a˙2∧. . .∧a˙m

by eliminating all occurrences of⊤, wherea˙k =ak ifbk =1,a˙k =ak ifbk = 0, and

˙

ak=⊤ifbk=_.

Example 5 The internal representation of the knowledge baseRbirdsfrom Ex. 1 is:

(9)

variables([f,b,a]). % propositional variables indices([1,2,3]). % list of indices for

% conditionals

% f b a f b a

conditional(1,[[_,1,_]],[[1,_,_]]). % (f|b) birds fly

conditional(2,[[_,1,_]],[[_,_,1]]). % (b|p) birds are animals conditional(3,[[1,1,_]],[[_,_,1]]). % (-f|p) flying birds are

% animals

Furthermore,GenOCFprovides the predicates

worlds(Ws) %Wslist of possible worlds

verifying worlds(i,Ws) %Wslist of worlds verifyingith conditional falsifying worlds(i,Ws) %Wslist of worlds falsifyingith conditional falsify(i,W) %worldW falsifiesith conditional

realising the evaluation of the indicator function (1) given in Sec. 2. The remaining part of GenOCFneeded forGenOCFO is the determination of vectors#»κas solutions ofCR(R).

The correspondingGenOCFpredicates closely follow the abstract specification ofCR(R) developed in Section 3.1 and are given in Figure 2.

4 Optimizing CR (R) by Transforming Inequations to Equations

The constraints inCR(R) given by (8) ensure that each conditional(Bi|Ai) ∈ Ris accepted. Since allκi are assumed to be natural numbers, we could replace the strict inequation (8) by

κi >1 + min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj − min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj (10)

without changing the set of solutionsSolCR(R). Generally, one is interested in minimal solutions, so one could be tempted so for minimizing the values of allκi , one could be tempted to replace the non-strict inequality in (10) by an equality as in:

κi = 1 + min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj − min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj (11)

However, using just (11), one might loose a solution in the case where the right hand side of the inequation (8) is negative since then (11) would require thatκi is negative. If (11) does not hold, the values of the vector(κi , . . . , κn)ensure that the conditional(Bi|Ai) is accepted, so that in that case no additional requirement onκi is needed.

Thus, we can use (11) only if 1 + min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj > min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj (12)

(10)

kappa(KB, K) :- % K is kappa vector of c-representation consult(KB), % for KB

constraints(K), % generate constraints for K labeling([], K). % generate solution

constraints(K) :-

indices(Is), % get list of indices [1,2,...,N]

length(Is, N), % N number of conditionals in KB

length(K, N), % gen. K = [Kappa_1,...,Kappa_N] of free var.

domain(K, 0, N), % 0 <= kappa_I <= N for all I accord. to (7) constrain_K(Is, K). % generate constraints according to (8) constrain_K([],_). % generate constraints for constrain_K([I|Is],K) :- % all kappa_I as in (8)

constrain_Ki(I,K), constrain_K(Is,K).

constrain_Ki(I,K) :- % gen. constr. for kappa_I as in (8) verifying_worlds(I, VWs), % all worlds verif. I-th cond.

falsifying_worlds(I, FWs), % all worlds falsif. I-th cond.

list_of_sums(I, K, VWs, VS), % VS list of sums for verif. worlds list_of_sums(I, K, FWs, FS), % FS list of sums for falsif. worlds minimum(Vmin, VS), % Vmin minium for verif. worlds minimum(Fmin, FS), % Fmin minium for falsif. worlds element(I, K, Ki), % Ki constraint variable for kappa_I Ki #> Vmin - Fmin. % constraint for kappa_I as in (8)

% list_of_sums(I, K, Ws, Ss) generates list of sums as in (8):

% I index from 1,...,N K kappa vector

% Ws list of worlds Ss list of sums

% for each world W in Ws there is S in Ss s.t.

% S is sum of all kappa_J with

% J \= I and W falsifies J-th conditional list_of_sums(_, _, [], []).

list_of_sums(I, K, [W|Ws], [S|Ss]) :- indices(Js),

sum_kappa_j(Js, I, K, W, S), list_of_sums(I, K, Ws, Ss).

% sum_kappa_j(Js, I, K, W, S) generates a sum as in (8):

% Js list of indices [1,...,N] I index from 1,...,N

% K kappa vector W world

% S sum of all kappa_J s.t.

% J \= I and W falsifies J-th conditional sum_kappa_j([], _, _, _, 0).

sum_kappa_j([J|Js], I, K, W, S) :- sum_kappa_j(Js, I, K, W, S1), element(J, K, Kj),

((J \= I, falsify(J, W)) -> S #= S1 + Kj; S #= S1).

Figure 2: CLP programGenOCFdetermining vectors as solutions ofCR(R)

(11)

1234567839ABCDE9F36751234567835426 1234567839ABC4DEAF77797483BF 1234567839A8BEAFE1234567839AB4EAF

1234567839A8BEAF3123456267797483BF 68!8394"#8454BEAE$%FE384524"#42 68&26'4 748!8394"#8454BEAE(%FE384524"#42748&26'4

#838#"#B$#83E$%FE$#83#838"#26 68!83&26'4

#838#"#B(#83E(%FE(#83#838"#26748!83&26'4

#35BEAEA8FEA81234567835 7687)26779 A8*+$#83(#831234567835267797483BF 123333333333333333333333333333333333333333333333332

1245678 9ABCDEF

123333333333333333333333333333333333333333333333332

22E2E2E2222222222212E2C2FD2929CD92DC2E2 22EEBE2E !"212E2EEB2#F2#C$E#E2%F$&2 229$99D72'2'E"22222222212'E2(FDCED2)CEC$92#F2*C++C,7 22'E2-3222E2.2E/2222212(FDCED2#F2*C++C,72C2E20"2

2221222C29ABCDEF

123333333333333333333333333333333333333333333333332 12581 9ABCDEF2

123333333333333333333333333333333333333333333333332

Figure 3: Optimization ofGenOCFby replacing inequations by equations

holds. Putting these constraints together yields κi = 1 + min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj (13)

−min{1 + min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj, min

ω|=AiBi

X

j6=i ω|=Aj Bj

κj}

Note that just as required, (13) reduces toκi = 0if (12) holds. Thus, our first optimization of CR(R)is to replace (8) by (13). Note that this optimization transforms a strictly- less-than relationship into an equation; thus it should be clearly distinguished from the modelling of a constraintx < ybyx+ 1 6 ywhich might be done by the underlying constraint solver.

For different notions of minimality, resulting from different orderings of the solution vec- tors #»κinSolCR(R), this optimization does not loose any minimal solution. For instance, this observation holds when#»κis compared to#»κby summing up the elements of the vec- tors, by a componentwise ordering of the vectors, or by a componentwise ordering of the full ranking functions induced by the vectors according to (9) (cf. [BKS12]).

A declarative implementation of this optimization inGenOCFis obtained by replacing the last three subgoals of in the predicateconstrain Ki/2(cf. Figure 2) is shown in Figure 3. Note that the new program code in Figure 3 closely follows the formulas given in (13).

It turned out that this optimization had a significant effect on the runtime ofGenOCFas

(12)

will be illustrated in Section 7.

5 Optimize Minimum Constraint Over List of Sums Containing 0

A typical set of constraints obtained from (8) may contain

κ1 > min{κ23,0} −min{κ2,0} (14) Since allκi are non-negative, both minimum constraints of this inequation will always return 0 regardless of any other constraints. Thus, we can optimise both the first minimum constraintmin{κ23,0}and the second minimum constraintmin{κ2,0}in (14) by 0, and further evaluating0∗0to0transforms (14) into just

κ1 >0 (15)

The optimisation is to avoid superfluous sum constraints where the minimum over a list of sums can be replaced by 0. Indead, this optimization can always be applied for any consis- tent set of conditionalsR. If a knowledge base is splitted intoordered partitions[GP96], all conditionals assigned to the first ordered partition give raise to this optimization. The tolerance condition [GP96] ensures that a verifying world for each conditional of the first orderd partition exists such that no other conditional of the whole knowledge baseRis falsified by this world. This leads to a sum of 0 as shown above.

To realise this optimisation, the predicateconstrain Ki/2 (cf. Figure 2) must be modified:

• It must be checked whether a verifying world exists such that no other conditional is falsified by that world

((once((verify(I,World), \+ falsify(_,World)))) and dually, if such a falsifying World exists:

((once((falsify(I,World), \+ (falsify(J,World),J \= I))))

• In case of such a world could be found, a list with only one constraint to sum 0 will be created. Otherwise the original predicatesverifying worlds/2(as well as falsifying worlds/2andlist of sums/4will be used to create the list of sum constraints.

The modification is implemented using two new predicatesverifying sumlists/3 andfalsifying sumlists/3. Calls to these new prediactes replace the calls to verifying worlds/2andfalsifying worlds/2inconstrain Ki/2. The optimized version ofconstrain Ki/2that also takes into account the first optimiza- tion presented in Section 4 is given in Figure 4 and 5.

(13)

1234567839ABCDE9F36751234567835426 1234567839ABC4DEAF77797483BF 1234567839A8BEAFE1234567839AB4EAF

1234567839A8BEAF3123456267797483BF 11234567589ABC4DEF1F11111DD1BC4DEF12345611C8E55C8D1 116DF567589ABC4DEF1F1111DD1BC4DEF16DF5611C8E55C8D1 11D5FAC6AFF1 1F1!11!1D5F1C61FF16C41234561BC4DEF1 11D5FAC6AFF1 1F1!11!1D5F1C61FF16C416DF561BC4DEF 123333333333333333333333333333333333333333333333332

1245678 9AB2CDEFE22

123333333333333333333333333333333333333333333333332

22EFABFF79 2212E!2F2D2FABF2D2!2"D#F2 22FEFABFF7$9 212E!2F2D2FABF2D2F!2"D#F2 123333333333333333333333333333333333333333333333332

1258% 9AB2CDEFE22

123333333333333333333333333333333333333333333333332

22$9BE2F2BE2&2'2 2222212$BE2B2E2(22)E 222221222BE2&2'2D)"F22"DA#

222221222#*F2(D"2

22BEBAB$BE2+$9BE,$9- 22212$BE2BEAB2D2FE2"D#F2 22BE722 22222222222122*DEF!2(2D2.//7 222032'2&2BE212$BE!222222212*DEFE2D2.//72F2E22 2

222221222F23ADE 123333333333333333333333333333333333333333333333332 1245678 9AB2CDEFE22

12 BEBAB+4566-27E 2/*#2")27E20322 123333333333333333333333333333333333333333333333332

367547845424 47483BF2!68"83#26$4 31$45%4761%26!68"83#26$4

&5'7!68"83#26$$24325748"7325%6123$858237 7 838 2(274 484744 $

83$)62 'EE*

A77!1526

+, ,84584524 4 EFABFF79AB8F

BB231BB!68"BE-26$FE./748"B9E-26$FFFF$247

!68"83#26$)845#%81%$24 325748"7325%6123$8582370 1+, 28453C(D 444 838 74(

5!68"839#26$4BE-26$4FE 284527!68#26$4 8459294 4BE-26$4EAE+, 2845F28452, 4

F

Figure 4: Optimization ofGenOCFw.r.t the minimum of list of sums (part 1/2)

6 Reduce Number of Sum Constraints

Suppose that from the constraints inCR(R)we have obtained the constraint κ2 > min{0, κ67, κ45, κ456, κ1, κ1, κ1, κ1}

−min{κ3, κ3, κ34, κ34, κ1, κ1, κ1, κ1} (16)

(14)

1234562472869ABCADEF75A722749ADE2A2B47ABCADE2972 123451657894AB354C4DEFFAB54C2

D6B47ABC9 2!"2B47ABC#9 #2!$2 2 22222222222222222222222222222222222221267242B47ABCADE2926%A72 222222222222222222222222222222222222212B47ABCADE2&'()*+,2#2!$2 2 222222222222222222222222222222222222212DAAD4-2

.22/350A72$21232

422B47ABCADEF97297 2 222A7FBF757975/350A7 2 2

AB74C257C

Figure 5: Optimization ofGenOCFw.r.t the minimum of list of sums (part 2/2)

(In fact, this constraint arises for one of the examples given in [M¨ul04]). With the opti- mization given in the previous section, (16) can be replaced by

κ2 > min{0} −min{κ3, κ3, κ34, κ34, κ1, κ1, κ1, κ1} (17) A further simplification is to remove duplicate sum constraints, yielding

κ2 > min{0} −min{κ3, κ34, κ1} (18) Furthermore, it is evident that a minimum constraintmin{κ3, κ34}may be reduced tomin{κ3}sinceκi >0. So if all constraint variables of a sum constraint are also part of another sum constrain, the larger sum constraint is superfluous and does not have to be issued to the constraint solver. Thus, our third optimization is to avoid

• duplicate sum constraints

• sum constraints greater or equal to other sum constraints

in order not to post a big bulk of redundant constraints, speeding upGenOCFbefore the constraint solver starts to calculate solutions and aiming at improving the overall perfor- mance ofGenOCF.

Based on the optimization in the previous sections, the new predicates verifying sumlists/3andfalsifying sumlists/3will be modified.

Generally, the way to to avoid spare sum constraints and to identify only relevant sum constraints will be changed. Two new predicates verify falsify stripped/2 and falsify falsify stripped/2 will replace the predicatesverifying worlds/2andfalsifying worlds/2. With these new predicates the search for verifying and falsifying worlds changes: The search for verifying resp. falsifying worlds is defined by constraints, so the iteration to search falsify- ing worlds for each verifying world is obsolet (see predicatefalsifying except/3).

With predicate stripedList all sum constraints greater or equal to other sum constraints are removed. The complete implementation of this optimization is given in Figures 6, 7, and 8.

(15)

1234546784927AA2AB9892CD29EF92792B522CD246BDB52C6A92 125AE49284294762DC6246BDB52C6A92

128 2D27246BDB52C6A2C4925C82D7A9BD275C8462C5B8BC57A2 1272FB5BFEF2CD2!2CD27AA29EF92B92799EF42

122222222B54"2D6CF2##$2 122222%222&77248C62

122222'(EF(AB9822AB982CD29EF9 2 46BDB5)9EFAB989#%#'(EF*B982 +2

22C5446BD#,C6A#2-.2D7A9BD)#,C6A212C49272

2 1246BDB52C6A24"B982B2C492

125C82D7A9BD275C8462C5B8BC57A/2 022'(EF*B982122!3 12499EF42FB5BFEF2792!2

52246BDB5)C6A9#2,C6A9#2 212*B982CD27AA246BD2C6A92 222AB98)CD)9EF9#,C6A9#%#'(EF*B98212*B982CD2(EF92

123333333333333333333333333333333333333333333333332 1245678 49AB2CDEFEF

123333333333333333333333333333333333333333333333332 AFF77F2

AFDF9F7F !9"F#2

123333333333333333333333333333333333333333333333332 1258$ 49AB2CDEFEF

123333333333333333333333333333333333333333333333332 2

12(7F4279246BDB5)9EFAB9826E8298768B52B82D7A9BDB52C6A92 D7A9BDB5)9EFAB989#%#'(EF*B982 +2

C54D7A9BD#,C6A#2-.2D7A9BD7#,C6A#72-122 12C49272D7A9BDB52C6A24"B982 22222222222222222222222222222222212D7A9BDB524$89:;272-122

12C5B8BC57A/2 +< '(EF*B982122!32

5 D7A9BDB5)C6A9#2,C6A9#2 AB98)CD)9EF9#,C6A9#%#'(EF*B982 123333333333333333333333333333333333333333333333332 1245678 49AB2CDEFEF

123333333333333333333333333333333333333333333333332 AFAFF77F2 AFDF9F7F !9"F#2

123333333333333333333333333333333333333333333333332 1258$ 49AB2CDEFEF

123333333333333333333333333333333333333333333333332 2

123333333333333333333333333333333333333333333333332 1245678 49AB2CDEFEF

123333333333333333333333333333333333333333333333332

12=6478492AB982CD2&772FB5E92B5B4928C2647842842AB982CD29EF2 12C59867B5892DC62842>;(82FB5BFB978BC52CD2842+6464945878BC52 12+25C2EAB78429EF2C59867B5892

12+2986B42AB982

1222B42B4522222#?3#2#?#@3#2A#B3#2A#B#C3#2C#332 12222222986B4222#?3#2A#B3#2C#332

Figure 6: Optimization ofGenOCFby reducing sum constraints (part 1/3)

(16)

123456789782

12A22 B B4CDE26F288264C3836423232DE7CDC2 1222222222222222F628D2D22

12B 839DC23826F23826F234C3D26F29923472 12222222222222223D2

1234567589A4567AB34CC2DEFA

F34C D86F D3F!" #$ 589A456722CB " #$$ $ %$

22212&2382382C7938D2 D86F' DD' %$ ($ 2212&D6D2C7938D2

839DC)38( B$* 2221283929D2726483482 12+D8D23826F2992347234C3D2862D8D28D23826F272 126483482F628D2,+-.23433836426F28D2/D9DD48836420$

12/2462C7938D2726483482 12/2839DC2382

12223*D213D422222 %3 2 % '3 2( 43 2( 4 53 25 6332 12222222839DC222 %3 2( 43 25 6332

123456789782

12A22 B B4CDE26F288264C3836423232DE7CDC2 1222222222222222F628D2D22

12B 839DC23826F23826F234C3D26F29923472 12222222222222223D2

589A4567589A4567AB34CC2DEA

2222F34C D86F F3F!A #$ 589A456722CB A #$$ $ %$ 2 12&2382382C7938D2

2222D86F' DD' %$ ($ 12&D6D2C7938D2

2222839DC)38( B$* 1283929D2726483482 12D26C2#2F3F!341264C383642D9DD48DC2!234CDE2B2 12DED98264C383642D9DD48DC2!272

12B4978252789782

12B B252 B4CDE26F22F3F3DC264C383642 127 B B4CDE26F242DE7CDC264C383642 12# B252 #6C2F3F!341264C383642B2 589A456722CBE

22223D"$ 1231487252"3D26F28D246DC1D2D2 2222D418" -"$ 12-282-7D26F23D2

2222D418# -"$ 12.DF34D2648*23D2D2F626C$2 2222C634# 9 $ 12B43833:D2648*23D252CDF34D2C6342 222234C3D+$ 2222222212B4C3D26F264C383642

2222D418+ -+$ 2222212-7D26F234C3D26F264C383642

2222C6342B3 -+$ 2212B43833D2C63426F264834823D232 2222B2;<827 22222222222212,E7CD264C38364272

222264C38364B = +$ 212>D8264C3836429D3F383642 2222DD= =$ 222222212DE8829D64C383642

2222DD+ +$ 222222212 DE88264D?7D4D2

222264@= #$ 22222222212 648348A2D26CD26F28D2 2222222222222222222222221222222222222229D64C383642

22224D1B64@+ #$ 2222212648348A2D26CD26F24D18DC2 22222222222222222222222212222222222222264C383642F3F!$2 2222D34123 #$ 2222212,ED78D2D2F626C2

2222D34123 2B3$*22212,ED78D2D2F6264C38364234C3D2 12839D223826F2726483482DD2992347234C3D$2 12223*D213D422222 %3 2 % '3 2( 43 2( 4 53 25 6332

12222222839DC222 %3 2( 43 25 6332

Figure 7: Optimization ofGenOCFby reducing sum constraints (part 2/3)

(17)

12345672

12 8 93A72B37CD672E65F37A2 12 9 4A735E293A72

12675672

1 9 735E293A72

123456784129ABC8D22A735E93A78892 A735E93A72

A735E93A78 8A9922 2222A735E93A78A9952

2222D4!!"99282#$2923493A7982

222222222222222212%A27C229234292A6C27C72923A22A6"A72D&28'2 2222222222(2292$29522222222222212)82*2A735282D672

2222222222+22554E89592212,22*2EE2827D27C2A735E2F3A72 22222

12-C.A2BC7C2F3A72/23A22A6"A72D&2F3A7202 1232/2$21223A22A6"72D&202$231242 12%45672

1 5 62 93A72/2 1 9 93A7202 4E84129FBD2 3493A75 6922

3493A7692

!!"592

12-727C2A6!2D4A7347A2FD47

122F3A72D&293A72D&234E3A2D&2.552!346A 12%4567

1222%A %%A2F3A72D&2F3A72D&234E3A

12228 .552!346A2D4A7347293"FA 1267567

1222:A6!93A7 93A72D&2A6!2D4A7347A F3A7D&A6!A2

F3A7D&A6!A%; ;A8:6!93A722 222F3A7D&A6!A%;A8:6!6!52

222&34EFF:&FA3&<:;2:2#$2%:A2 222A6!.55:A86!2222222222222222222222 222554E6!:6!6!5:6!93A72

412112

F3A7D&A6!A%A %%A8:6!93A722 222F3A7D&A6!A%%A8:6!6!52 222A6!.55%A86!2

222554E6!:6!6!5:6!93A7 2

A E1234E21

Figure 8: Optimization ofGenOCFby reducing sum constraints (part 3/3)

(18)

7 Implementation and First Evaluation

We implemented the three optimizations developed above and applied them to the sythetic knowledge bases of the formkb synth<n> c<2n−1>.plwhich were introduced in [BKS12]. In Figures 9 and 10, results of applyingGenOCFwith and without the opti- mizations are shown. It is intesting to note that the first optimizations has the biggest effect on the runtimes, while the other two optimizations are still significant.

1234567869ABC6 DEBF D328 26 123456 123457 123458 9ABCADE 32CFB2 5B6527

1AC2 5 ! CCC " " " ##$ $ ##%$

1AC2 5 ! CCC & " " '#($ #$ '#!$

1AC2 5 ! CCC & & " ()$ #$ ($

1AC2 5 ! CCC & & & #$ #$ $

1AC2!* 5 * * CCC " " " ))$$ !$ ))$'$

1AC2!* 5 * * CCC & " " '%'$ #$ '(%$

1AC2!* 5 * * CCC & & " *$ '$ *!$

1AC2!* 5 * * CCC & & & )$ )$ $

Figure 9: Runtimes ofGenOCFwith and without employing optimizations 1, 2,3

1234567869ABC6 DE2F6955C6327C

FBF329 FBF3299 FBF32999

BD 327 D38DB 32CFDB2 D38DB 32CFDB2 D38DB 32CFDB2

1234567893ABCDE BF B 123 ! 43 53

1234567893ACDE BF 113 633 663

1234567893ACDE BF " 753 # 673 623

1234567893ACDE BF 213 ! 653 ! 643

1234567893ACDE BF # $ 68343 133 ! 153

1234567893ACDE BF % 1963 # 173 733

1234567893ACDE BF # 66193 " 153 763

1234567893ACDE BF %# 98A3 733 # 793

1234567893A9CDE BF 9 %" 9523 # 773 " 753

1234567893ABFCDE BF BF $" 4A33 $$ 443 $$ 483

1234567893ABBCDE BF BB !## 5923 % 6113 % 6693

1234567893ABCDE BF B #! 8783 " 6AA3 $ 6433

1234567893ABCDE BF B $"$ 74A83 % 9613 1673

1234567893ABCDE BF B $ 4313 !! 7583 ! 1513

1234567893ABCDE BF B $ 143A3 #" 87A3 % 7713

1234567893ABCDE BF B $% 11473 $!% 4513 %$ 9193

1234567893ABCDE BF B # 11863 " 133A3 ### 8893

Figure 10: Runtimes ofGenOCFwith optimizations for knowldege bases with 10 variables and increasing number of conditionals

(19)

8 Conclusions and Further Work

We presented three stepwise optimizations of a high-level declarative CLP program com- puting the solutions of a constraint satisfaction problem specifying ranking functions that accept the conditionals of a knowlegde base. A first implementation and its applications to various examples illustrates the effects of the optimizations. The biggest effect is obtained by a sharpening of the original constraint satisfaction problem; this optimizations trans- forms inequations to equations, but without loosing any minimal solutions. Among our current work is the development of further refinements and a more detailed investigation of the benefits of the different optimizations.

References

[BDP92] S. Benferhat, D. Dubois, and H. Prade. Representing default rules in possibilistic logic.

InProceedings 3th International Conference on Principles of Knowledge Representation and Reasoning KR’92, pages 673–684, 1992.

[BKI11] C. Beierle and G. Kern-Isberner. On the Computation of Ranking Functions for Default Rules – A Challenge for Constraint Programming. InProc. Deklarative Modellierung und effiziente Optimierung mit Constraint-Technologie. Workshop at GI Jahrestagung 2011, 2011.

[BKS11] C. Beierle, G. Kern-Isberner, and K. S¨odler. A Constraint Logic Programming Approach for Computing Ordinal Conditional Functions. In25th Workshop on Logic Programming (WLP 2011), INFSYS Research Report 1843-11-06, pages 9–21. TU Wien, 2011.

[BKS12] C. Beierle, G. Kern-Isberner, and K. S¨odler. A Declarative Approach for Computing Or- dinal Conditional Functions Using Constraint Logic Programming. In19th International Conference on Applications of Declarative Programming and Knowledge Management, INAP 2011, and 25th Workshop on Logic Programming, WLP 2011, Wien, Austria, Re- vised Selected Papers, Lecture Notes in Artificial Intelligence. Springer, 2012. (to ap- pear).

[BP99] R.A. Bourne and S. Parsons. Maximum entropy and variable strength defaults. InPro- ceedings Sixteenth International Joint Conference on Artificial Intelligence, IJCAI’99, pages 50–55, 1999.

[DeF74] B. DeFinetti.Theory of Probability, volume 1,2. John Wiley & Sons, 1974.

[GMP93] M. Goldszmidt, P. Morris, and J. Pearl. A maximum entropy approach to nonmonotonic reasoning.IEEE Transactions on Pattern Analysis and Machine Intelligence, 15(3):220–

232, 1993.

[GP96] M. Goldszmidt and J. Pearl. Qualitative probabilities for default reasoning, belief revi- sion, and causal modeling.Artificial Intelligence, 84:57–112, 1996.

[KI98] G. Kern-Isberner. Characterizing the principle of minimum cross-entropy within a conditional-logical framework.Artificial Intelligence, 98:169–208, 1998.

[KI01] G. Kern-Isberner.Conditionals in nonmonotonic reasoning and belief revision. Springer, Lecture Notes in Artificial Intelligence LNAI 2087, 2001.

(20)

[KI02] G. Kern-Isberner. Handling conditionals adequately in uncertain reasoning and belief revision.Journal of Applied Non-Classical Logics, 12(2):215–237, 2002.

[M¨ul04] C. M¨uller. Implementing default rules by optimal conditional ranking functions. B.Sc.

Thesis, Dept. of Computer Science, FernUniversit¨at in Hagen, Germany, 2004. (in Ger- man).

[Par94] J.B. Paris. The uncertain reasoner’s companion – A mathematical perspective. Cam- bridge University Press, 1994.

[PV97] J.B. Paris and A. Vencovska. In defence of the maximum entropy inference process.

International Journal of Approximate Reasoning, 17(1):77–103, 1997.

[Spo88] W. Spohn. Ordinal conditional functions: a dynamic theory of epistemic states. In W.L.

Harper and B. Skyrms, editors,Causation in Decision, Belief Change, and Statistics, II, pages 105–134. Kluwer Academic Publishers, 1988.

[Wey98] E. Weydert. System JZ - How to build a canonical ranking model of a default knowledge base. InProceedings KR’98. Morgan Kaufmann, 1998.

Referenzen

ÄHNLICHE DOKUMENTE

The Moreau-Yosida approximates [7, Theorem 5.81 are locally equi-Lipschitz, at least when the bivariate functions FV can be minorized/majorized as in Theorem 4. This is a

Bereanu, The continuity of the optimum in parametric programming and applications to stochastic programming, J.Optim.Theory Applic. Robinson, A characterization of stability

It surely seems desirable to gain the second perspective on admissibility with re- spect to defeasible reasoning. The ways of induction are multifarious and do not seem

Neither are my (fair) betting ratios always inde- pendent of the truth values of the propositions I am betting on, nor are they never affected by the stakes at issue. The

This appears excluded, for the formal reason that there is a theory of integra- tion and thus of expectation in probabilistic, but none in ranking terms; this is at least what I

If the agents epistemic state at time t is represented by the ranking function p on A, and if, between t and t', the agent becomes certain of the proposition E E A

The notion of cyclomatic flow complexity has been derived by means of theoretical considerations. This feature contradicts empirical evidence that the complexity

The third approach can either generate well posed, locally minimal problems or can be used to find search-free puzzles of a given difficulty grade that can not be further