Description
|
PROJECT GOAL
The goal of this project is to understand Constraint Satisfaction Problems (CSP) as well as to implement a program that solves a constraint satisfaction problem. You will need to understand Back-tracking, Forward Checking, and other various heuristics for this assignment. Do in pairs or solo. |
PROJECT DESCRIPTION
The following is an example of a bag-packing problem. Imagine a group of thieves broke into a store! There are N items of various weights in the store, and the thieves are carrying M bags (a bag for each thief) with each bag having a maximum capacity. Your task is to come up with a program that helps filling the bags under certain constraints. We will use the following notation for this project:
|
INPUT SPECIFICATION
Your program (or a script accompanying your program) must accept a filename as a single command-line argument. For example, you might run your program by typing “java Project2 filename.txt” or “runProject2 testfile.txt”. The test file specified by the argument has a specific format:
|
TEST FILES
Several test files will be made available during the course of the project. Your program must work on all of them. One sample file is included below: ##### - variables (items and their weight) A 30 B 30 C 30 D 30 E 40 F 35 H 45 ##### - values (bags and their capacity) x 70 y 90 z 80 ##### - fitting limits (each bag must have 1 item and not more than 3 items 1 3 ##### - unary inclusive (item B can go in bag z or y) B z y ##### - unary exclusive (-first line below item A can not go in bag z) A z E y ##### - binary equals . (item C and B need to be in the same bag) C B ##### - binary not equals (Item A and E need to go in different bags) A E ##### - mutual inclusive (If Item F is in either bag y of z than H must be in the other bag) F H y z
|
OUTPUT SPECIFICATION
Use standard output or file-output(to current directory) to show your result. The output of the system should be:
sample output:
x D E
number of items: 2
total weight: 70/70
wasted capacity: 0
y A B C
number of items: 3
total weight: 90/90
wasted capacity: 0
z F H
number of items: 2
total weight: 80/80
wasted capacity: 0
The items / bags in the output don’t have to be in any particular order, as long as the solution is correct. Similarly, if there are multiple solutions to a problem, any of them are acceptable as long as they’re in the above format. If there are multiple solutions, your program doesn’t have to find them / output them all; only one is needed.
|
PROJECT ASSIGNMENT
You must solve this bag-packing problem by implementing various algorithms. The simplest algorithm that you need to implement is backtracking depth-first search. You also need to implement forward checking, constraints propagation, and heuristics for choosing variables and values for variables. |
THE CODE
Design and implement a constraint satisfaction system that produces an assignment of bags to items which satisfies all constraints, if such an assignment exists. You can implement your program in any high level language (remember the autograder does not work with c/c++). Your system should satisfy the following requirements:
Extra Credit
|
DELIVERABLES
A zip file (name as YOURUSERNAME.zip or USERNAME1_USERNAME2.zip for pairs) which contains the following:
PROJECT SUBMISSION
Through canvas.wpi.edu
-Backtracking 50 -Correct solution 20 to the variable/value assignments -Minimum Remaining Values (MRV) + degree heuristic 5 -Least Constraining Values (LCV) heuristic 5 -forward checking 5 -Comparisons of methods and clean report 15 - Please report on reliability when you compare algorithms- You can do that in your code or dump your data sets and do outside of your code ------------------------------- TOTAL = 100 -Bonus points for also implementing MinConflict and local search +10 -Bonus Points for arc consistency +10 FAQ:
1) The file (ie “our-more-harder(longer)-problems-submitted …”) has some problems that a student gave me that were taking his program a long time to solve ( 3 seconds to solve without heuristics.)
The file “Test Inputs and Solutions 2019.zip” has some examples and ONE solution for each (there can be many!). Note #15 is removed due to some bug.
2) When you are trying to compare the speeds of algorithms I suggest using one of the harder problems as the easy problems will be be very indicative.
|