A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under...

22
A Logical Framework for Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara, Turkey) Michael Kifer (Stony Brook University, USA) Ismail H. Toroslu (Middle East Technical University, Ankara, Turkey)

Transcript of A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under...

Page 1: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

A Logical Framework for Workflow Scheduling

under Resource Allocation Constraints

Pinar Senkul(Middle East Technical University, Ankara, Turkey)

Michael Kifer(Stony Brook University, USA)

Ismail H. Toroslu(Middle East Technical University, Ankara, Turkey)

Page 2: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Problem

Workflow Scheduling:

Find execution sequence of tasks in a workflowworkflow so that all constraintsconstraints are satisfied

Page 3: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

DefinitionsWorkflow:

A coordinated set of activities that act together to achieve a well-defined goal

Constraints: Temporal/causality

Do t1 only after t2 and t3 have been executedDo t1 if t2 has been or will be executed

Resource allocationExecute workflow keeping the cost below thresholdDon’t use same machine for concurrent subtasks in workflow

Page 4: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Problem (contd.)

Most works deal with temporal/causality constraints

We deal with resource allocation constraints

Page 5: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Example: House Construction Workflow

The budget should not exceed the given amountThe construction should not last longer than the given durationDifferent companies must be chosen for parallel tasks

Page 6: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Approaches to Workflow Scheduling

Operations ResearchAIPetri NetsLogic (temporal, concurrent transaction logic)

Page 7: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Our Approach

CCTR – Concurrent Constraint Transaction LogicIntegrates Concurrent Transaction Logic (CTR) with

Constraint Logic Programming (CLP)

Gives precise semantics to workflows

CanModel

Reason about

Schedule

workflows

Page 8: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Overview of Concurrent Transaction Logic

Extension of first order logic for programming, executing and reasoning with state changing concurrent processes.

Syntax wall ⊗ (( carpentry ⊗ roof ) | installation )

execute wall then in parallel do:carpentry followed by roofinginstallation work

Semantics – paths⟨D0D1D2D3D4⟩

wallwall carpentrycarpentry installinstall roofroof

D0 D1 D2 D3 D4

any interleaving of carpentry⊗roof and installation is a valid execution

Path: sequence of DB states that result from execution of activities

Page 9: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Concurrent Constraint Transaction Logic (CCTR)

syntax: same as in CTR

semantics: partial schedule is more structured thana path, parallel and serial parts of the execution are explicitly shown.

e.g. (⟨D0D1⟩)•p(⟨D1D2•pD2D3⟩ ||p⟨D1D4⟩)

Page 10: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Resources

resource: an object with the attributes cost, token

resource assignment: a partial mapping

partial schedules → set of resources

Page 11: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Constraint System

A partial schedule satisfiessatisfies a resource allocationconstraint c if

c(partial schedule, resource assignment)is true.

A constraint systemconstraint system is a set of constraintdefinitions. It consists of

cost subsystemcost subsystem: contains definitions of cost constraints

control subsystemcontrol subsystem: contains definitions of control constraints

Page 12: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Cost Subsystem - House Construction Workflow

Template: generic procedure for computing costs over schedules

cost_constraint(ω,asg) = value_constraint(cost(ω,asg))cost(ω1•pω2 ,asg) = op⊗(cost(ω1,asg),cost(ω2,asg))cost(ω1||pω2 ,asg) = op|(cost(ω1,asg),cost(ω2,asg))

Problem-specific part for the constraint: "construction should not exceed the given duration”

cost(ω,asg) = cost_of(asg(ω)) value_constraint(V) = V < cop|(V1,V2)= max(V1,V2)op⊗(V1,V2)= V1+V2

Cost of path ω

Schema for computing costs over composite schedules

Page 13: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Control Subsystem - House Construction WorkflowTemplate: generic procedure for computing control constraints

ctrl_constraint(ω1•pω2,asg) = set_constraint⊗(asg(ω1),asg(ω2)), ctrl_constraint(ω1,asg), ctrl_constraint(ω2,asg)

ctrl_constraint(ω1 || pω2,asg) = set_constraint|(asg(ω1),asg(ω2)), ctrl_constraint(ω1,asg), ctrl_constraint(ω2,asg)

ctrl_constraint(ω,asg) = leaf_constraint(asg(ω))

Problem specific part for the constraint: "Different subcontractors must be chosen for parallel tasks”

set_constraint| (R1,R2) = (token_of(R1) ∩ token_of(R2) =∅ )

Satisfy constraints on sequentialsequentialcombo of part.sched

Satisfy constraints on parallelparallel combo of p.sched

Satisfy constraints on each each p.schedp.sched

separatelyseparately

Satisfy constraints on each each p.schedp.sched

separatelyseparately

Page 14: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Logical Entailment in Constraint SystemM, ζ, ω, asg ¦ ϕ

iff

M, ω ¦ ϕ,Ð ¦ cost_constraint( ω, asg) andÐ ¦ ctrl_constraint( ω, asg)

Constraint system Partial

schedule

m-path structure

Resource assignment

CCTR formula

Constraint universe

Page 15: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Using CCTR as a Workflow Scheduler

Take a CCTR workflow which includes constraintsConstruct an equivalent CTR workflow so that:

There is a 1-1 correspondence between the partial schedules of the CCTR workflow and the resulting CTR workflow

These partial schedules & resource assignments for them are computed by the proof theory of CTR

Can now schedule conjunction-free workflows using CTR interpreterCan take advantage of prior work on scheduling workflows under causality/temporal constraints

Page 16: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Transformation Rules

B(G1 ∨ G2) = B(G1) ∨ B(G2)

B(G) = R(G,T)⊗ cost_constraint(T)⊗ ctrl_constraint(T)

R(A,T) = A⊗ (T=resource_asg(A,Agents))

R(G1 | G2, T) = (T='|'(T1,T2))⊗ (R(G1,T1) | R(G1,T2))

R(G1⊗G2, T) = (T='⊗'(T1,T2))⊗ (R(G1,T1) | R(G1,T2))

R(G1∨ G2, T) = R(G1,T) ∨ R(G2,T)

basically structural induction with insertion of constraints inappropriate places

Page 17: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Transformation for Part of House Construction Example

T='|'(T1,T2)⊗((T1= '⊗' (T3,T4)⊗

(((cc ⊗T3=rsrc(c,W)) ⊗(rr ⊗ T4=rsrc(r,X))))

|(T2='|'(T5,T6)⊗

(((ii ⊗ T5=rsrc(i,Y)) |(ee ⊗ T6 = rsrc(e,Z)))))

⊗ cost_constraint(T) ⊗ ctrl_constraint(T)

((carpentry ⊗ roof) | (installation | ceiling)) ∧cost_constraint ∧ ctrl_constraint

Page 18: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Constraint Template – Cost Constraints

Template:cost_constraint(T) :- cost(T,V), value_constraint(V)

cost((T1,T2),V) :- cost(T1,V1), cost(T2,V2), op|(V1,V2,V)

cost(⊗(T1,T2),V) :- cost(T1,V1), cost(T2,V2), op⊗(V1,V2,V)

cost(resource_asg(T,Agents),V):- cost_of(resource_asg(T,Agents),V)

User-defined terms and predicates:

resource_asg(T, A) := rsrc(T,A)cost_of(rsrc(T,A),V) :- duration(T,A,V)value_constraint(V) :- V <cop|(V1,V2,V) :- V = max(V1,V2 )op⊗(V1,V2,V) :- V = V1+V2

-Logic rules that mimic the definition of the cost part of a constraint system

Ensures that duration is within constraints

Page 19: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Constraint Template-Control Constraints

Template:ctrl_constraint(|(T1,T2)) :- set_constraint|(T1,T2),

ctrl_constraint(T1), ctrl_constraint(T2)

ctrl_constraint(⊗(T1,T2)) :- set_constraint⊗(T1,T2), ctrl_constraint(T1), ctrl_constraint(T2)

ctrl_constraint(T) :- leaf(T), leaf_constraint(T)

User-defined predicates:

set_constraint|(T1,T2):- disjoint(T1,T2)

set_constraint⊗(T1,T2) :- true

leaf_constraint(T) :- true

-Same for the control part of a constraint system

Ensures that resources are not shared on

parallel paths

Page 20: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Correctness of the Transformation

Theorem:

Let ζ be a constraint system and Ð be aconstraint domain, which can be represented using the template rules. Then, thetransformation B is a correct prescheduler(I.e., B yields equivalent workflows that satisfy

constraints)

Page 21: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

The Big Picture

G Workflow

G’=B(G) Const.

set

Const. def.

Transfornation Rules

CTR Interpreter Constraint

Solver Resource assignment

Rsrc asg term schedule

Page 22: A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under Resource Allocation Constraints Pinar Senkul (Middle East Technical University, Ankara,

Conclusion

Presented a logical framework for modelling and scheduling workflows under resource allocation constraints (implemented using a CTR interpreter and XSB)

This framework can be extended with special-purpose constraint solvers optimised for our framework

Scheduling under resource allocation constraints for dynamically changing workflows and for multiple concurrent instances of the same workflow are topics for future work