Questions tagged [b-prolog]

B-Prolog is a high-performance implementation of the standard Prolog language with several extended features including matching clauses, action rules for event handling, finite-domain constraint solving, arrays and hash tables, declarative loops, and tabling.

B-Prolog is a high-performance implementation of the standard Prolog language with several extended features including matching clauses, action rules for event handling, finite-domain constraint solving, arrays and hash tables, declarative loops, and tabling.

First released in 1994, B-Prolog is now a widely used CLP system.

The constraint solver of B-Prolog was ranked top in two categories in the Second International Solvers Competition, and it also took the second place in P class in the second ASP solver competition and the second place overall in the third ASP solver competition.

B-Prolog underpins the PRISM system, a logic-based probabilistic reasoning and learning system.

B-Prolog is a commercial product, but it can be used for learning and non-profit research purposes free of charge (since version 7.8 for individual users, including commercial individual users, B-Prolog is free of charge)

Source:http://en.wikipedia.org/wiki/B-Prolog

13 questions
4
votes
1 answer

Uneven tabling performance in BProlog 8.1

I did a few experiments with the tabling capabilities of b-prolog version 8.1 and was quite surprised by the performance I observed. Here is the code that I used. It counts the number of Collatz steps N required for reducing some positive integer I…
repeat
  • 18,496
  • 4
  • 54
  • 166
4
votes
5 answers

Prolog: append number to a term

Is it possible to append a number to a term directly? I.e., I can easily do something like this: ?- A = 1 + 2, B = 3, C = A + B. C = 1+2+3 But is there a way (operator?) to specify something instead of '+' in the C = A + B to get "C = 1+23"? I…
Sergii Dymchenko
  • 6,890
  • 1
  • 21
  • 46
3
votes
2 answers

Nested loops with accumulators in B-Prolog

B-Prolog has logical loops. For example, that's how we can calculate sum of [1,2,3]: test1 :- foreach(A in 1..3, [], ac(Sa, 0), ( Sa^1 is Sa^0 + A )), writeln(sa(Sa)). ?- test1. test1. sa(6) yes But when I try two…
Sergii Dymchenko
  • 6,890
  • 1
  • 21
  • 46
3
votes
2 answers

Table modes and backtracking in B-Prolog

Consider the program: :- table cost(+, min). cost(1, 0). cost(1, 1). cost(2, 1). I expected that result to cost(I, C). would be I = 1, C = 0; I = 2, C = 1 - all possible input arguments with corresponding minimum results. But I get only…
Sergii Dymchenko
  • 6,890
  • 1
  • 21
  • 46
3
votes
3 answers

Prolog infinite loop

This is a program that should find out who is compatible with john. I am new to Prolog. In order to let Prolog know eg. met(X,Y) = met (Y,X) lots of code has been written. Now when I start the query ?- compatible(john, X) it goes into infinite…
r0n1am
  • 33
  • 1
  • 6
2
votes
1 answer

8 queens puzzle Netbeans(java) graphical interface + SWI prolog

I'm found a solution, only on Bprolog, and ask for a help how to translate it by JPL on SWI PROLOG? OR maybe you can take me solution by jpl libriry using // by Nobukuni Kino import java.awt.*; import java.awt.event.*; import…
2
votes
1 answer

Can I subtitude functor with variable in a predicate

I am new to prolog, and using BProlog. I have been reading some example program to execute query on group of related data. But in order to infer from facts with similar structure, they wrote many predicates like search_by_name,search_by_point, which…
Jokester
  • 5,501
  • 3
  • 31
  • 39
1
vote
2 answers

Lexicographically order two lists of variables using constraints

I'm trying to implement a lexicographic ordering constraint in BProlog using its CLP(FD). As far as I can see from the manual BProlog doesn't provide a built-in lexLeq constraints (though there exist efficient propagation algorithms for this global…
Bakuriu
  • 98,325
  • 22
  • 197
  • 231
1
vote
2 answers

Workaround ensure_loaded/1 B-Prolog?

Is there a workaround to make ensure_loaded/1 work in B-Prolog as it works in many other Prolog systems? The goal is to have a preamble so that the rest of code can use ensure_loaded/1 independent of whether which Prolog system I use. It seems…
user502187
1
vote
1 answer

Reading numbers from stdio in B-Prolog

What's the easiest way to read a number or several space-separated numbers (NOT followed by a period) in B-Prolog from standard input? For example, for ECliPse I wrote these simple predicates (I don't need error handling): read_number(N) :- …
Sergii Dymchenko
  • 6,890
  • 1
  • 21
  • 46
0
votes
1 answer

How to call BProlog goal from a C program?

The documentation of BProlog mentions: "B-Prolog has a bi-directional interface with C through which Prolog programs can call functions written in C and C programs can call Prolog as well. C pro- grams that use this interface must include the file…
alecail
  • 3,993
  • 4
  • 33
  • 52
0
votes
1 answer

Running CG graphics on BProlog?

i recently installed B-prolog and tried CG graphics examples from here http://www.probp.com/ According to their manual, i've installed B prolog in C:/ drive and its compiling propoerly but not executing them. This is…
Abhilash Muthuraj
  • 2,008
  • 9
  • 34
  • 48
0
votes
1 answer

Prolog for loop syntax error

I am trying to make a game similar to minesweeper and i need to check the neighbours of a square in the map but i get a syntax error at my for loop, I am using SWI-Prolog checkneighbours(X,Y) :- retractall(vecini(_)), assert(vecini(0)), foreach(I in…
Bogdan
  • 402
  • 2
  • 8
  • 18