27
Implementing Semiring-Based Constraints using Mozart Alberto Delgado Carlos Alberto Olarte Jorge Andres Perez Camilo Rueda 1 1 Pontificia Universidad Javeriana-Cali Mozart/Oz Conference 2004 Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Implementing Semiring-Based Constraints using Mozartatlas.puj.edu.co/~caolarte/puj/cursos/semI/slides/soft/moz2004.pdf · Implementing Semiring-Based Constraints using Mozart Alberto

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Implementing Semiring-Based Constraints usingMozart

Alberto Delgado Carlos Alberto Olarte Jorge Andres PerezCamilo Rueda 1

1Pontificia Universidad Javeriana-Cali

Mozart/Oz Conference 2004

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Motivation

CSP

CSP is an expressive approach for modelling many real lifeproblems, but it is not flexible enough to deal with:

Over-constrained settings

Non-crisp constraints

Preferences

Uncertainties

SCSP

SCSP extends CSP by allowing preferences, uncertainty,probabilities and similar ideas. Some proposals:

Fuzzy CSP [Dubois,93]

VCSP [Schiex,95]

Partial CSP [Freuder,92]

C-semirings [Bistarelli,97]

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

MotivationCont.

The problem

There are not many solvers for SCSP. Most of them using CLP:

CLP(FD,S) [Georget,98]

Semiring integration with CHR [Bistarelli, 02]

Evaluation-based semiring Meta-Constraints [Kelleher,03]

But, what about CCP?

Our contribution

To integrate mechanisms for handling semiring-based constraintsinto the Mozart system.

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

C-semiring formalism

Defines a semiring structure 〈A,+,×, 0, 1〉 where :

A is the set of possible valuations× is used to combine constraints+ is the operator to order the elements in A (a ≥s biff a + b = a)0, 1 are the min and max elements in A

Some instances:

Classic CSP: 〈{false, true},∨,∧, false, true〉Fuzzy CSP: 〈{x | x ∈ [0, 1]},max ,min, 0, 1〉Weighted CSP: 〈<+,min,+,+∞, 0〉

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

C-semiring formalism (cont.)Some Definitions

A Constraint System is a tuple 〈V ,D,S〉 where V is a set ofvariables, D the variable domains and S a c-semiring

A Constraint is a tuple 〈def , con〉 where con is a set ofvariables and the function def : D |con| → A represents thetuple valuations.

Given c1 = 〈def1, con1〉 and c2 = 〈def2, con2〉, the ConstraintCombination c1 ⊗ c2 is the constraint c3 = 〈def3, con3〉 withdef3(t) = def1(t ↓con1

con3)× def2(t ↓con2con3

) and con3 = con1 ∪ con2

A Soft CSP (SCSP) is a tuple 〈C , con〉 where C is a set ofconstraints and con a set of variables

Sol(P): The solution of the SCSP P = 〈C , con〉 is theconstraint

⊗ci∈C ↓con

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

An Example

Given the SCSP:

Using SFuzzy , defSol(P)(2, 1) = min(0.6, 0.2, 0.4) = 0.2,defSol(P)(1, 1) = 0.3 and 〈2, 1〉 ≤s 〈1, 1〉Using SWeighted , defSol(P)(2, 1) = +(0.6, 0.2, 0.4) = 1.2,defSol(P)(1, 1) = 1.1

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

How does CCP work in Mozart

Propagation

Propagatorsimpose constraintsnarrowing thevariable domains

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

How does CCP work in Mozart

Distribution

Propagation is notcomplete. When acomputation spacebecomes stabletwo choices arecreated: in mostcases Xi = V andXi 6= V

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Soft Propagators

We provide propagators (soft ones) dealing with thec-semiring formalism concepts

They exploit standard mechanisms (CPI) for extending Mozartwith new constraint systems and user-defined constraints

Each propagator implements a filter and a valuation (def )function. The latter is computed only when the propagatorbecomes entailed, saving space and time.

Filter is written according to the valuation function

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Current Implementation

Propagators

Soft propagators for: LessThan,Equal , AllDiferent ,UnaryPreference , nPreference , Distance constraints.

Useful mechanisms that make expressing soft statements easier

Softness Degree : Makes propagators harder or softer

minLevel of preference (α): Rejects solutions wheredef (t) <s α

Mechanisms to extend our implementation

An abstract class to create new soft-propagators

Classes and procedures handling semiring operations

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

How does it work?

Let X ∈ [3..5],Y ∈ [1..10] and Z ∈ [2..6]. Imposing {Soft.lt X Y}and {Soft.lt Y Z} we get:

minLevel=0.5 and SDegree=0.4

def (〈2, 3〉) = 1.0

def (〈3, 3〉) = 1.0− 0.4 = 0.6

def (〈3, 2〉) = 1.0− 0.4− 0.4 =0.2 ≤s 0.5

mLevel=0.6,SDegree=0.5

Soft.lt is like FD.lt and onlytuples where di < dj areallowed.

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

An over-constrained timetabling problem

Problem

To allocate conferences with preferences and disjoint constraints a

aC. Schulte, G. Smolka. Finite Domain Constraint in Mozart

Solution in [Schulte,Smolka. 2004]

FD.atMost: enforcing the maximum number of parallelsessions

FD.<: imposing precedence constraints

FD.distinct: enforcing disjoint constraints

Turning it over-constrained

Adding some precedence constraint, the solver fail

Solution?: Changing FD.<: by Soft.< and/or FD.distinct bySoft.distinct

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Frequency Assignment Problem

This problem tries to assign communication channels to radio linksfrom limited spectral resources.

constraints

xi = fi pre-assigned frequency (soft)

|xi − xj | > dij when xi and xj may interfere together (soft)

|xi − xj | > δij defines a duplex link (hard)

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Frequency Assignment Problem (cont.)

The Model

Use Sweighted c-semiring

Use Soft.eq to impose pre-assigned constraints andSoft.distance for imposing interference ones

Use FD.distance to define duplex links

# Vars # Cons Time(ms)

14 20 036 27 056 167 1086 338 20121 543 70158 795 90200 1322 140

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Outline

1 IntroductionC-semiring formalismCCP in Mozart

2 Implementing Soft ConstraintsSoft Propagators

3 Results / ExamplesAn over-constrained timetabling problemFrequency Assignment ProblemImposing Preferences

4 Conclusions

5 Future Work

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Imposing Preferences

Preferences

Given a variable, we can define preferences over elements inits domain. e.g.

Color : red � white � blue

And given two variables we can define conditional preferences.e.g.

Shape = circle : Color = blue � Color = white

In most cases, not all the preferences can be satisfied.Solution?: Use CP-Nets and solve a SCSP [Rossi et all, 2003]

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Imposing Preferences (cont.)

A Simple CP-Net

Steak � Fish � Chicken

Red wine � White wine

Rise � Fries

Fish : White wine � Red wine

Chicken : Fries � Rise

The model

Choose the fuzzy or weighted c-semiring

Impose independent preferences by means of theUnaryPreference propagator

Impose conditional preferences by means of the nPreferencepropagator

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Advantages

Advantages Using a semiring-based approach?

Avoids a double distribution process

Solution can be easily compared (by using +)

Allows to impose preferences and Soft Constraints by makingorthogonal changes in the model and source code

It is easy to make propagators harder or softer

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Conclusions and Future Work

Conclusions

Soft, a new Mozart module to handle semiring-basedconstraints

We model hard constraints (i.e by using FDs propagators)without using soft constraint (i.e by using Scsp and thensolving a multicriteria problem)

Adding preferences and soft constraints can be achievedwithout change the core of the application and/or model.

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Future Work

Future Work

Extend our set of soft propagators.

Include soft ideas into the distribution process.

Implement the abstraction scheme [Bistarelli,02], by usinginformation obtained from processing the abstract problem inthe distribution process of the concrete one.

Test our implementation on real-life applications.

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.

Thank you!

Delgado A., Olarte C., Perez J. and Rueda C. Implementing Semiring-Based Constraints using Mozart.