[Official] Assignment 1

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

[Official] Assignment 1
The first assignment is at https://kwarc.info/teaching/AI/assignment.pdf

This semester we will use studon teams for the first time. So please bear with us if this doesn’t work right away:

  • When submitting your solutions, studon lets you create a Team and add your members.
  • Every member of the team can edit the submission.
  • Studon is configured to accept a single file per problem (pl for Prolog problems, pdf for others).
  • After grading, each member receives the same number of points.
  • Studon stores the teams separately for every question. So make sure you select your team for each problem.

All future assignments will be available at the same URL.
The list of past assignments will be at https://kwarc.info/teaching/AI/assignments.pdf


Hi,

we implemented the myPermutations function, which returns true for a permutation and false if it is not a permutation.
How can we now tell Prolog to print out all possible permutations as shown in the assignment sheet?

Help is appreciated! :wink:

Thank you!


I’ve fixed two semantically relevant typos in the assignment.


You keep asking for more solutions. Prolog finds and returns the next one each time.
In Swish, that’s the Next button.


EDIT: fixed it, see below.
Will leave that comment here for others :slight_smile:

Thank you for your quick answer!

Sadly, it does not seem to terminate :confused: How long shall we wait for the next output?
Do you think that there is a problem with our program/implementation then?

Error Output:
[color=crimson]Stack limit (0.2Gb) exceeded
Stack sizes: local: 3Kb, global: 0.2Gb, trail: 0Kb
Stack depth: 4,463,499, last-call: 100%, Choice points: 15
In:
[4,463,499] takeout(3, _1342, _1344)
[34] myPermutations(‘<garbage_collected>’, ‘<garbage_collected>’)
[33] myPermutations(‘<garbage_collected>’, ‘<garbage_collected>’)
[32] myPermutations(‘<garbage_collected>’, ‘<garbage_collected>’)
[31] swish_trace:swish_call(‘<garbage_collected>’)

Use the --stack_limit=size[KMG] command line option or
?- set_prolog_flag(stack_limit, 2_147_483_648). to double the limit.[/color]

EDIT:
I changed the options for the recursive call of myPermutations and now it worked… now we get all permutations! I guess the problem was that we didn’t have the recursion for myPermutations at first position.


Hi,

are we allowed to use for example (if → then; else).

Thanks


Could another file extention for the Prolog files be added? „.pl“ is commonly used for Perl files, so it would be nice if I could avoid confusion by using „.pro“ or „.P“ files.


You don’t need if-then-else. And you learn more if you don’t use it. But it’s OK if you do.


It’s OK if studon renames the pl files.


I’ve posted the solutions in https://kwarc.info/teaching/AI/assignments.pdf

All assignments/solutions posted so far will always be in that file.