COMP 3120 Fall 2020: Assignment 1
Develop a combination selection program in Haskell.
This program will produce all of the options for something for a user based on their preferences.
The primary example is the Submarine Sandwich Combination Selector.
The Submarine Sandwich Problem:
A submarine sandwich is a common meal, but selecting a superior configuration of options can be difficult since preferences vary greatly by person.
A submarine sandwich is usually defined as having a length (6¡± or footlong), a type of bread (white, brown, flatbread, etc.), toppings (roast beef, egg salad, tuna, lettuce, tomatoes, etc.), and seasonings (mayonnaise, ranch dressing, salt, pepper, etc.).
The combination of options can affect the nutritional characteristics of a sandwich (calories, protein, sodium, etc.) and its flavour profile (sweet, spicy, simple, complex, etc.). Other dimensions could be considered (how well the sandwich holds together, visual appearance, etc.).
If someone requests a sandwich like this, how many combinations are possible?
On flatbread with beef or ham and lots of veggies but no pickles and really spicy but less than 2000 kCal
Main Requirements
To complete this assignment, you will need to:
1. Represent a domain of configurable options. Feel free to use the primary example (submarine sandwich), or use something else of your interest. You will need to identify the options and dimensions of interest. For submarine sandwiches, you could use the information on a restaurant website as a source of ideas and details.
You will need to consider the level of detail and scope of your program. This is not a trivial decision. More detail and scope will increase your grade, but beware of the risk of making it so complicated that you cannot complete the assignment. One suggestion is to start simple and build up.
2. Make a Haskell program that can generate reasonable combinations and compute any necessary characteristics (such as calories).
3. Be able to take a user request and find all of the combinations that match that request.
You will need to decide how the user request is configured: e.g., an interactive text dialogue (question and answer), or a preferences text file, or in the program code itself. You will be graded on how easy this is to access and use. Definitely include a description of how the requests need to be phrased or formatted (either as part of the interface or in an instruction manual).
4. Output all of those combinations. The nicer this looks, the better.
If it is possible to sort the combinations (e.g. by price), you can include this functionality.
This program must be written in Haskell. You may import standard Haskell libraries and any of your own code.
Marking Criteria
This assignment will be marked for correctness, sophistication, and creativity. Specifically, the following things will be considered as part of your grade:
– Correctness (20 marks): Does your program meet all of the main requirements (even minimally)?
– Detail/Scope (10 marks): How closely does your program represent a real world problem? How much
functionality does it implement with regard to defining options and characteristics?
– Efficiency (4 marks): Can your program compute many options in a reasonable amount of time?
– Complexity (10 marks): How impressive is the interaction scheme of your program? Are you using any advanced
programming techniques (e.g. parallelism, graphics)?
– Haskelliness (3 marks): Does your program take advantage of Haskell¡¯s characteristics? Does it match the
functional programming paradigm?
– Code style & Documentation (3 marks): Can a user read and understand your code?
Notes
Coding Style
Clarity matters. Appropriate function names, function types/signatures, and comments (where necessary) are all expected. Marks will be reduced if the code is hard to understand.
Integrity
If you include any code from any source other than yourself, you must cite the source. Usually a weblink is sufficient. Do not overdo this, but it is okay to use a small amount of code that helps you solve a specific problem. It is definitely better to learn from outside code and write it on your own, however. Any other form of copying will be dealt with formally and could result in a failed grade.
Submission
Submit your program files and any documentation on Moodle. Late submissions will be subject to a penalty. Contact me by e-mail (pjackson@tru.ca) if you have any questions or requests regarding this assignment.