Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exsched Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm.

Similar presentations


Presentation on theme: "Exsched Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm."— Presentation transcript:

1 Exsched Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm

2 Motivation Designing schedules is a problem that arises quite frequently: Designing schedules is a problem that arises quite frequently: Class schedules Class schedules Employee schedules Employee schedules Examination schedules Examination schedules These schedules have a tabular, 2-D structure These schedules have a tabular, 2-D structure In general, many constraint satisfaction problems such as timetabling problems, scheduling problems, recreational puzzles can be modeled as tables of constraints In general, many constraint satisfaction problems such as timetabling problems, scheduling problems, recreational puzzles can be modeled as tables of constraints Use of spreadsheet paradigm for this purpose Use of spreadsheet paradigm for this purpose Goal: Design an interface that facilitates the interactive development of such tabular schedules Goal: Design an interface that facilitates the interactive development of such tabular schedules

3 CS Class Schedule

4 Spreadsheet Paradigm Our solution: Use the spreadsheet paradigm Our solution: Use the spreadsheet paradigm Spreadsheets: Popular for arithmetic computations Spreadsheets: Popular for arithmetic computations Uses the paper and pencil approach Uses the paper and pencil approach Arithmetic expressions are interactively entered and evaluated until desired results are obtained Arithmetic expressions are interactively entered and evaluated until desired results are obtained Repetitive computations are performed by copying expressions from one cell to another, with appropriate transformation applied Repetitive computations are performed by copying expressions from one cell to another, with appropriate transformation applied Regular spreadsheets can not handle constraints Regular spreadsheets can not handle constraints We generalize spreadsheets so that finite domain constraints can also be entered in the cells We generalize spreadsheets so that finite domain constraints can also be entered in the cells Knowledgesheet Knowledgesheet Exsched: plug-in for Microsoft Excel Exsched: plug-in for Microsoft Excel

5 Interface Interface similar to regular spreadsheet (extension of MS Excel) Interface similar to regular spreadsheet (extension of MS Excel) Each cell can be thought of as a variable or place holder Each cell can be thought of as a variable or place holder A user can enter finite domain values in a cell. These finite domain values denote the finite domain of the variable corresponding to the cell. A user can enter finite domain values in a cell. These finite domain values denote the finite domain of the variable corresponding to the cell. Example: [1..5] Constraints can also be entered in the cell. Constraints contain variable names (cell coordinates) and constants. Constraints can also be entered in the cell. Constraints contain variable names (cell coordinates) and constants. Example: B3 #= C4 + 1

6 Interface (cont’d) Constants can also be entered in the cell: the variable corresponding to that cell is set to the constant entered Constants can also be entered in the cell: the variable corresponding to that cell is set to the constant entered Constraints/constants/finite domains can either be entered into the current cell or via dialog boxes Constraints/constants/finite domains can either be entered into the current cell or via dialog boxes Lots of built-ins are available as clickable buttons Lots of built-ins are available as clickable buttons Once constraints/constants/finite domains are entered, the system automatically collects them, composes a clp(FD) program, solves it using clp(FD) engine running in the background and displays the solution Once constraints/constants/finite domains are entered, the system automatically collects them, composes a clp(FD) program, solves it using clp(FD) engine running in the background and displays the solution The user must enter at least one Query Table and zero or more Auxiliary Tables The user must enter at least one Query Table and zero or more Auxiliary Tables Query Table is used to compose the query Query Table is used to compose the query Auxiliary table turns into facts Auxiliary table turns into facts Computed results for the query are displayed in the query table Computed results for the query are displayed in the query table

7 Example: Employee schedule Scheduling managers at a store: Scheduling managers at a store: Store opens 8 AM to 11 PM, 7 days/week Store opens 8 AM to 11 PM, 7 days/week Each manager must work 8.5 hr / day (includes 0.5 hrs for lunch) Each manager must work 8.5 hr / day (includes 0.5 hrs for lunch) Each manager must work 5 days / week Each manager must work 5 days / week At least one manager must be present at any moment At least one manager must be present at any moment Someone with night shift should not get morning shift next day Someone with night shift should not get morning shift next day Schedule must be fair to all managers Schedule must be fair to all managers In most cases, this scheduling is done manually In most cases, this scheduling is done manually Erroneous, leads to employee dissatisfaction Erroneous, leads to employee dissatisfaction

8 Solution: Employee Schedule Assume that there are 5 managers Assume that there are 5 managers Each manager works 8.5 hrs per day either in Each manager works 8.5 hrs per day either in The morning shift (8:00 AM to 4:30 PM), or The morning shift (8:00 AM to 4:30 PM), or The midday shift (10:00 AM to 6:30 PM), or The midday shift (10:00 AM to 6:30 PM), or The evening shift (2:30 PM to 11:00 PM) The evening shift (2:30 PM to 11:00 PM)

9 Solution: Employee Schedule (cont’d) An Empty Table

10 Solution: Employee Schedule (cont’d) Morning, midday and evening shifts are denoted by 5, 2 and 4 respectively Morning, midday and evening shifts are denoted by 5, 2 and 4 respectively 0 will be used to indicate a manager’s day off 0 will be used to indicate a manager’s day off Domain of each cell: [0,2,4,5] Domain of each cell: [0,2,4,5] User enters domain in one cell, copies it to rest User enters domain in one cell, copies it to rest For no morning after night restriction, we enter the constraint: For no morning after night restriction, we enter the constraint: C2 != B2 + 1 (copied everywhere) At least one manager is present at any time during the day: At least one manager is present at any time during the day: member(4,[D2,D3,D4,D5,D6]), member(5,[D2,D3,D4,D5,D6]) No manager works for more than 5 days a week: No manager works for more than 5 days a week:frequency(0,[B2,C2,D2,E2,F2,G2,H2],2) Every manager has more or less same proportion of morning, midday and evening shifts: Every manager has more or less same proportion of morning, midday and evening shifts:sublist([2,4,5],[B2,C2,D2,E2,F2,G2,H2])

11 Solution: Employee Schedule (cont’d) Table after adding further constraints

12 Solution: Employee Schedule (cont’d) Note: Cell constraints are replicated in all 35 cells, column constraints in B7 through H7 and row constraints in I2 through I6. [0,2,4,5], C2 != B2 + 1 (Cell Constraints) count(0,[B2,C2,D2,E2,F2,G2,H2],=,2), sublist([2,4,5], [B2,C2,D2,E2,F2,G2,H2]) (Row Constraints) member(4,[D2,D3,D4,D5,D6]), member(5,[D2,D3,D4,D5,D6]) (Column Constraints)

13 Solution: Employee Schedule (cont’d) Displaying a solution

14 Solution: Employee Schedule (cont’d) Displaying a solution

15 Example: The 3x3 Grid Puzzle Cell constraints: B3: B3+C3+D3 #= 15, B3+B4+B5 #= 15 B3: B3+C3+D3 #= 15, B3+B4+B5 #= 15 C3: C3+C4+C5 #= 15 C3: C3+C4+C5 #= 15 D3: D3+D4+D5 #= 15 D3: D3+D4+D5 #= 15 B4: B4+C4+D4 #= 15 B4: B4+C4+D4 #= 15 B5: B5+C5+D5 #= 15, B5+C4+D3 #= 15 B5: B5+C5+D5 #= 15, B5+C4+D3 #= 15 D5: B3+C4+D5 #= 15, alldiff([B3,B4,B5,C3,C4,C5,D3,D4,D5]) D5: B3+C4+D5 #= 15, alldiff([B3,B4,B5,C3,C4,C5,D3,D4,D5])

16 Solution: The 3x3 Grid Puzzle

17 Example: Cryptarithmetic Puzzles Most puzzles have such a graphical structure; for example, Zebra puzzle

18 Conclusion Advantages of the Knowlodgesheet Approach: Advantages of the Knowlodgesheet Approach: Flexibility Flexibility Interactivity Interactivity Non-experts can use it Non-experts can use it Domain specific knowledge can be incorporated Domain specific knowledge can be incorporated User and clp(FD) system cooperate to produce solutions User and clp(FD) system cooperate to produce solutions User can give partial solutions, compute rest with Knowledgesheet User can give partial solutions, compute rest with Knowledgesheet Disadvantages: Disadvantages: Works only for tabular clp(FD) programs Works only for tabular clp(FD) programs No help if the system is overconstrained No help if the system is overconstrained


Download ppt "Exsched Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm."

Similar presentations


Ads by Google