Using prolog make a code to get some compared outputs but some outputs not working properly. seems those are not comparing with facts. here the code
fact(Fact) :- Fact,!.
fact(Fact):-Fact = ..[Rel, Arg1, Arg2],isa(Arg1, SuperArg).
SuperFact…
So what I get is a list that contains coordinates in a matrix. For example:
List 1: [[1, 1], [2, 1], [3, 1], [4, 1], [2, 2], [1, 3], [2, 3], [3, 3], [4, 3]]
List 2: [[1, 1], [2, 1], [3, 1], [4, 1], [1, 3], [2, 3], [3‚3], [4, 3]]
I need to figure…
I have this knowledgebase in prolog of a air company and their flighs:
flight(departure,arrive,day).
flight(london,paris,monday).
flight(paris,barcelona,thursday).
flight(paris,madrid,sunday).
flight(madrid,lisbon,saturday).
recursive…
Given a table
name ip
A = |A 1 |
|B 1 |
|C 1 |
|B 2 |
|C 2 |
|D 3 |
|E 2 |
If any two names share same ip they belong in same group. Also ip with same name belong in same group. If…
Given facts such as:
Jake is smarter than Nik
Nik is smarter than Wes
Wes is smarter than
Dik
Write a recursive program that will determine that Jake's is smarter than Dik's.
The solution that I have is:
smarter(jake, nik).
smarter(nik,…
i have to find route between two states and ive reached here and i am having error as of now regarding out of stack help me
% state 1 is border of state 2
% borders(A , B).
borders(sasktchewan, alberta).
borders(saskatchewan,…
i have connections between cities like
connection(London,Sziget).
connection(Sziget,Kairo).
so i want to create a predicate to find if there is a possible route between two cities even passing through other cities first.
Input example:…
Let's say we have a robot that is on a Chess Board and can move like a King can.
The board is with coords from [1,1] to [8,8].
The starting position is [1,1] the final is [8,8]. There is a list X that contains lists of obstacle's coords for example…
I've implemented Warshall's algorithm in a MySQL Stored Procedure. Unfortunately the procedure takes a long time to complete. I'm a beginner in writing Stored Procedures, do you know what I can do, to make it faster?
Brief explanation: I'm trying to…
I'd like to simulate the equivalence in Prolog with the properties of being commutative and transitive, here is what I did: equal/2 will be supplying as facts.
symmetricEqual(A,B):- equal(A,B).
symmetricEqual(A,B):-…
I'm using GCC 4.5.0 with boost 1.48.0 on a Linux machine.
While compiling a source file that uses the boost::transitive_closure() function from boost::graph I'm encountering the same problem as in…
This is a query using sql CTE's to create a transitive closure of a table containing relations
between users.(edges of a graph).
How can this be done in mySQL?
WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS
( SELECT a, b, 1 AS…
Using the Snap SPARQL Query view I do not find a way to query the transitive closure e.g. of the property ex:myontology#isPartOf so that I can infer that, since A isPartOf AB which isPartOf ABC which isPartOf ABCD then A isPartOf ABC and ABCD.
Any…
I'm trying to design a general purpose transitive closure implementation: find all the nodes in a graph reachable in one or more steps from a given start node.
Or should it be zero or more steps?
That is, should the result automatically include the…