Закрыт

prolog coding urgent

6.1. Let us go back to our (directed) network of the previous

homework, depicted here. Again, and for completeness, we could

represent this network with the following Prolog statements:

link(a,b).

link(a,c).

link(b,c).

link(b,d).

link(c,d).

link(d,e).

link(d,f).

link(e,f).

link(f,g).

In the previous homework, we defined the (recursive) predicate

`connection(X,Y)` which is true if and only if we can get from some

node `X` to another node `Y` via a series of links. Now the task is

to "augment" this predicate, or add a bit more information to it.

Formulate the appropriate Prolog predicate `path(X,Y,N)` which is true

if and only if there is a path of length `N` from nodes `X` to `Y`.

For example, there is a path of length 2 from `a` to `d`: `a->b->d`,

but also `a->c->d`, and so `path(a,d,2)` gives `true` (two times).

There is also a path of length 3 from `a` to `d`: `a->b->c->d`. Test

this predicate out on the above network to verify whether or not it is

working correctly. Once this is working correctly, note now, that

e.g., `path(a,e,N).` will give multiple answers: (a) what do these

mean this time? (b) How could I use this predicate (i.e., in a query

or a sequence of queries) to determine the shortest path between two

nodes?

6.2. Remember the `take` function of Haskell? It can be defined in

Haskell as:

take :: Int -> [a] -> [a]

take 0 _ = []

take _ [] = []

take n (x:xs) = x : take (n-1) xs

Formulate the appropriate Prolog predicate `take(N,Xs,Ys)` which is

true if and only if `Ys` is what results from taking `N` elements from

`Xs`. That is, `take(3,[1,2,3,4,5],[1,2,3]).` would evaluate to

`true`, or `take(3,[1,2,3,4,5],Ys).` would give `Ys = [1,2,3]`

6.3. The sequence of Pell numbers 0,1,2,5,12,29,70,169,408,.. can be

defined recursively as the sequence of numbers in which the first two

numbers are 0 and 1, and each subsequent number is given by adding 2

times the preceding number to the number which precedes this. This

can be defined in Haskell as:

pell :: Int -> Int

pell 0 = 0

pell 1 = 1

pell n = 2 * pell (n-1) + pell (n-2)

Formulate the appropriate Prolog predicate `pell(N,Pn)` which is true

if and only if `Pn` is the `N`-th term of the sequence of Pell numbers

(note that we start numbering the sequence of Pell numbers with 0).

That is, `pell(8,408).` would evaluate to `true`, or `pell(5,Pn).`

would give `Pn = 29`

Навыки: Пролог, Программирование на C++, Программирование на С, Lisp, Python

Показать больше: add agent information mosets hotproperty, oscommerce add product information, add username input flash show results, prolog in ai, logic programming with prolog, prolog programming, prolog tutorialspoint, prolog tutorial, prolog download, prolog examples, prolog programming for artificial intelligence, vbnet task hours add, outlook task form add field, prolog coding, urgent need small task, I need a logo designed for my t-shirt company. I want it simple with a bit of flare. Vector art for the crown....and if possible, how much does it cost to add a feature to an app, how much does it cost to add a bedroom to a house, an example of an urgent and important task is, coding bootcamp worth it

О работодателе:
( 419 отзыв(-а, -ов) ) Mutrah, Oman

ID проекта: #27754980

4 фрилансеров(-а) готовы выполнить эту работу в среднем за $48

ahmsak

Hello, Sir... As agreed ............................................................................................

$60 USD за 1 день
(139 отзывов(-а))
6.7
idleswell

Thanks for your project. I use Prolog programming daily in my regular employment. I will complete these exercises in Prolog. I will use SWI Prolog (swipl) for these tasks. A milestone payment for the full budget for Больше

$72 USD за 3 дней(-я)
(67 отзывов(-а))
5.2
tuanthanhle

I can do it. i am very good at kind of this project. I am sure i can help you on this project. Please contact me if you need to discuss more

$40 USD за 1 день
(13 отзывов(-а))
4.0
theatasolution1

*** I am ready to get started my work right away *** Hello, I'm an expert C,C++ developer with experience in object-oriented, data structure and more advanced. I can help you to finish this project with great quality Больше

$20 USD за 1 день
(18 отзывов(-а))
4.3