Programming Assignment 3: Introductory Prolog


Table of Contents


Problem Domain

This assignment is intended to build familiarity with the Prolog programming language.


Project Infrastructure

You will need to download and install your own version of SWI-Prolog. It is freely available from http://www.swi-prolog.org/ for major operating systems. Major Linux distributions have copies available within their package system.


Problem

You are given a directed graph specified in what is termed "arc-clausal form" where, a prolog clause (or fact) is specified for each edge. An example graph and its representation appears below.

You may assume that edge costs are positive.

Graph




arc(m,p,8).
arc(q,p,13).
arc(q,m,5).
arc(k,q,3).






Write a Prolog predicate path(A,B,P) that returns some shortest path from A to B, for any graph with positive edge costs.


Submission

Submit your assignment via Canvas using these submission instructions.


Evaluation

Unlike the previous programming assignments, we are purposefully not providing test cases. Part of the assignment is to invent your own test cases and enhance you code to ensure you can handle them. Your code will be evaluated on general graphs. Important: The graph above is a benign instance, intended to get you started. Do not assume that because the graph and query above does not have some property, that the test cases also will not. If in doubt, please ask!


Academic Integrity: "An Aggie does not lie, cheat, or steal, or tolerate those who do." For additional information please visit: http://student-rules.tamu.edu/aggiecode

Getting Help: You are not alone! If you find yourself stuck on something, contact the TA for help. Office hours are there for your support; please use them. If you can't make our office hours, let us know and we will schedule more. We want these projects to be rewarding and instructional, not frustrating and demoralizing. But, we don't know when or how to help unless you ask.