当前位置:天才代写 > 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 > Programming Languages代写 Programming Languages代写 Prolog代写

Programming Languages代写 Programming Languages代写 Prolog代写

2021-01-12 16:50 星期二 所属: 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 浏览:611

CSCI 4430/6430 Programming Languages Fall 2019

Programming Languages代写 This assignment is to be done either individually or in pairs. Do not show your code to any other group and do not look

Programming Assignment 3

Deadline: 7:00pm EST December 02, 2019

This assignment is to be done either individually or in pairs. Do not show your code to any other  group and do not look at any other groups code. Do not put your code in a public directory or otherwise make it public. However, you may get help from the mentors, TAs, or the instructor. You are encouraged touse the Submitty Discussion Forum to post problems so that other students can also answer/see the answers.

This assignment will strengthen your understanding of logical and constraint based programming through application in either Prolog or Oz. You will be tasked with solving systems that have constraints specified in a subset of natural language.

Please be honest with your submitted code. Any solution that simply prints out the correctanswer without performing calculations that lead to the correct answer will result in a zero for the entire assignment.

Programming Languages代写
Programming Languages代写

Part 1: Curious Set of Integers Programming Languages代写

This section serves as a warm up to get you used to working with Prolog/Oz under a constraint based programming model. You will be presented with a simple puzzle (representing a constraint programming problem) that you must solve.

Puzzle Description Programming Languages代写

The original version of this puzzle was posed by Martin Gardner in February 1967.

The integers 1,  3,  8,  and 120 form a set with a remarkable property:  the product  of any two integers is     one less than a perfect square. Find another set containing four unique numbers between 0 and 10000 that  also has this property and it contains no numbers from the original set of {1, 3, 8, 120}.

Code Requirements

Your code should print the results to the standard output as comma separated values.

Example Output Programming Languages代写

$ 1,3,8,120

Part 2: Parsing Constraints and Building Interesting Sets

One of the advantages of logical programming is that parsing languages comes naturally from the compu- tational model. In this section you will be tasked with creating a parser for a specified grammar and using the resulting parse tree to solve a simple constraint programming problem.Programming Languages代写

The grammar that you will be using accepts sentences  that  define the  constraint  programming problem of finding a set of integers with specific properties, called interesting sets. Some examples of sentences thatthe grammar accepts are: Find a set of 2 odd integers that sum to 16 and Find a set of2 even and 3 odd integers that multiply to 120. Note that this grammar accepts sentences that correspond to a constraint programming problem with no solutions: Find a set of 2 even in- tegers that sum to 3. To help make your search space smaller you can assume that each element in the set has a value  between 0 and 128 inclusive.  Note that the values in a set must be unique and their     order does not matter.

Interesting Sets Grammar

  • S
  • I

Find a set of I that Op to Number

Even integers | Odd integers | Both integers Programming Languages代写

  • Even
  • Odd
  • Both

Number even Number odd Even and Odd

  • Op  sum | multiply
  • Number  | | | 

Code Requirements

Your code should accept as input a string that defines the constraints of a particular interesting set of inte- gers. There are three possible types of output for your program depending on if the string is invalid in the grammar, there is no solution to the problem, or at least one solution exists:

  • Invalid input: $ InvalidString
  • No solution to the problem: $ NoSolution Programming Languages代写
  • Atleast one solution exists: Comma separated list of values (shown in section below)

Example Input/Output Input:

Find a set of 3 odd integers that sum to 15

Output:

$ 3,5,7

General Code Requirements Programming Languages代写

Each part of this assignment should have its own source code file named part x.oz or part x.pl (x = 1, 2). Output for each file should go to standard output and more detailed specifications may be found in the corresponding sections above.

Sample code has been provided on the PA3 website. This starter code takes as input a single string and then prints that string to standard output. In order to run the starting code follow the same instructions provided below in the Running Code sections.

Setting Up Oz

The most up to date version of Oz/Mozart (2.0) does not allow for constraint programming. Consequently, you are required to use Mozart 1.4.0 which only runs on 32-bit operating systems. Since most modern systems are 64-bit, we have created a virtual machine in the provided file.This will provide you with an environment that already has Oz/Mozart 1.4.0 fully installed and ready to go.To log into the VM the first time the password is student and will remain that way unless you change it.

Running Oz Code

Your code will be run in the following way on Submitty:

  • $ ozc -c partoz
  • $ ozengine part 1.ozf > parttxt
  • $ ozc -c partoz
  • $ ozengine part 2.ozf “Example Input String” > parttxt Programming Languages代写

Setting Up Prolog

If you plan to use Prolog for this assignment you are required to use SWI-Prolog which can be found here.

Running Prolog Code

  • $ swipl -q -f part 1.pl -t main > parttxt
  • $ swipl -q -f part 2.pl -t main “Example Input String” > parttxt

Grading Programming Languages代写

Submissions will be graded according to the following rubric:

Part 1 20%
Part 2 70%
Code Clarity/ Comments 10 %
Programming Languages代写
Programming Languages代写

其他代写:考试助攻 计算机代写 java代写 function代写paper代写  web代写 编程代写 report代写 数学代写 finance代写 python代写 java代写 code代写 代码代写 project代写 Exercise代写 assembly代写 matlab代写

合作平台:天才代写 幽灵代写 写手招聘 Essay代写

 

天才代写-代写联系方式