ridgeworks / clpbnr Goto Github PK
View Code? Open in Web Editor NEWCLP(BNR) module for SWI-Prolog
License: MIT License
CLP(BNR) module for SWI-Prolog
License: MIT License
Not sure if this is a bug or not but when i do ?- {X == 1.1}, write_term(X, [attributes(write)]).
i get a massive printout and then a crash (mac OS X Catalina, SWI-Prolog version 8.2.1, clpBNR 0.9.0).
/JC
Hello,
I just wanted to let you know that doing a pack_install(clpBNR).
or pack_upgrade(clpBNR).
in swi-prolog will upgrade clpBNR to the version 0.11.0
and fails to load with the following error:
?- use_module(library(clpBNR)).
ERROR: /home/kwon-young/.local/share/swi-prolog/pack/clpBNR/prolog/clpBNR.pl:29:
ERROR: Domain error: `module_header' expected, found `:-print_message(error,history(expande
d("This version of clpBNR requires SWIP 9.1.5 or greater")))'
Since version 0.11.0 has no release on github, I suppose the fact that it is available on swi-prolog.org is an error.
Hello,
I use clpBNR a lot these days and I also use the graphical debugger of swi prolog a lot.
However, the graphical debugger does not show the interval range of clpBNR constrained variables.
It would simplify the debugging of constraints a lot if we could see them in the graphical debugger like normal constraints.
I noticed the other day that constraints from clpfd are correctly shown in the graphical debugger, so I suppose clpBNR constraints could be shown similarly.
Thank you a lot for your work on this library.
Using in Void Linux:
% *** clpBNR v0.10.2 ***.
% Arithmetic global flags set to prefer rationals and IEEE continuation values.
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.0)
?- {X>Y, Y>X}, solve([X,Y]).
X::real(-1.0Inf, -1.8014397958628724e+16),
Y::real(-1.0Inf, -1.8014397958628724e+16) ;
I expected this to fail.
Dear Rick, dear community. I come here with a proposal of feature / enhancement.
Please note that there might already be a way (maybe with your lib or with "plain" prolog), that I may have missed, because I am fairly new to Prolog.
Here is a small example concerning the link between cartesian 2d coordinates, and its representation in circular coordinates.
%SWI-Prolog (threaded, 64 bits, version 9.1.10)
:- use_module(library(clpBNR)). %documentation at : https://ridgeworks.github.io/clpBNR/CLP_BNR_Guide/CLP_BNR_Guide.html
cartesian_circular(X, Y, R, Theta):-
[X, Y, R]::real(-1.0e+16, 1.0e+16),
[Theta]::real(-pi, pi),
{
X == R * cos(Theta),
Y == R * sin(Theta)
}.
test1_(R, Theta):-
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
solve([R, Theta]).
%answers :
%R::real(-53.851650867757314, -5.099019332794144),
%Theta::real(-1.3258177199522887, -0.019997279208893784) ;
%R::real(5.099019290218574, 53.85164889904919),
%Theta::real(1.8157749415368631, 3.121595456378679) ;
This is nice, but, how to I get a list of valid answers ?
My wish / idea would be ask for "automated" subsampling of the answer space (subsambling of the "inputs", "outputs" and both ).
Bellow, some examples with comments :
expected_feature_subsampling_1_1(R, Theta):-
%Here, the expected feature would be to subssample the answer set based on a subsampling of the "INPUTS".
%Practically, in this example, this would be "get the R,T coords of a grid of points in a rectangle between xmin, xmax, ymin, ymax"
%idea 1 : using an absolute subsampling step
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_absolute_step(X, 5.0), % this would be like [-50.0, -45.0, -40.0, .. -10.0, -5.0]
%subsample_absolute_step(Y, 2.0), % this would be like [1.0, 3.0, 5.0, .. 15.0, 17.0, 19.0, 20.0] <- yes, I think this is good to keep the extrem values, even if this does not match the abs step.
solve([R, Theta]).
expected_feature_subsampling_1_2(R, Theta):-
%idea 2 : using a relative subsampling step (a ratio)
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_relative_step(X, 0.1), %i.e. 10% relative : (-5.0 - (-50.0)) * 0.1 = 45.0 * 0.1 = 4.5 of absolute step (see subsample_absolute_step)
%subsample_relative_step(Y, 0.1), %i.e. 10% relative : (20.0 - 1.0) * 0.1 = 19.0 * 0.1 = 1.9 of absolute step (see subsample_absolute_step)
solve([R, Theta]).
expected_feature_subsampling_1_3(R, Theta):-
%idea 3 : give the number of samples wanted
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_nb_elems(X, 15), %15 subsampled elements, and we keep the extremums (min and max of interval)
%subsample_nb_elems(Y, 10), %10 subsampled elements, and we keep the extremums (min and max of interval)
solve([R, Theta]).
expected_feature_subsampling_2_1(R, Theta):-
%Here, the expected feature would be to subssample the answer set based on a subsampling of the "OUTPUTS".
%Practically, in this example, this would be "get the R,T coords in a rectangle between xmin, xmax, ymin, ymax, and subsample the output space R,T"
%idea 1 : using an absolute subsampling step
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_absolute_step(R, 5.0), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
%subsample_absolute_step(Theta, pi/10.0), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
solve([R, Theta]).
expected_feature_subsampling_2_2(R, Theta):-
%idea 2 : using a relative subsampling step (a ratio)
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_relative_step(X, 0.1), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
%subsample_relative_step(Theta, 0.1), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
solve([R, Theta]).
expected_feature_subsampling_2_3(R, Theta):-
%idea 3 : give the number of samples wanted
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_nb_elems(R, 15), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
%subsample_nb_elems(Theta, 10), % same idea as examples expected_feature_subsampling_1 (but on "outputs")
solve([R, Theta]).
expected_feature_subsampling_3_1(R, Theta):-
%Here, the expected feature would be to subssample the answer set based on a subsampling of variables, whatever if they are "inputs" or "ouputs"
%Here, this would be very nice that the lib "tries its best" when the subsampling is no longer feasible, because previous subsampling already reduced the space.
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_nb_elems(X, 15), %15 subsampled elements, and we keep the extremums (min and max of interval)
%subsample_nb_elems(Theta, 10), %10 subsampled elements, and we keep the extremums (min and max of interval)
solve([R, Theta]).
expected_feature_subsampling_3_2(R, Theta):-
%Here, this would be very nice that the lib "tries its best" when the subsampling is no longer feasible, because previous subsampling already reduced the space.
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_nb_elems(X, 15), %15 subsampled elements, and we keep the extremums (min and max of interval)
%subsample_absolute_step(Theta, pi/10.0), % Here, this would be very nice that the lib tries its best
solve([R, Theta]).
expected_feature_subsampling_3_3(R, Theta):-
%Here, this would be very nice that the lib "tries its best" when the subsampling is no longer feasible, because previous subsampling already reduced the space.
X::real(-50.0, -5.0),
Y::real(1.0, 20.0),
cartesian_circular(X, Y, R, Theta),
%subsample_nb_elems(X, 15), %15 subsampled elements, and we keep the extremums (min and max of interval)
%subsample_absolute_step(Theta, pi/10.0), % Here, this would be very nice that the lib tries its best
%subsample_absolute_step(Y, 2.0), %here, I am not even sure this is feasible / compatible with the other subsamplings. But this would be nice if the lib tries to do it (if feasible) or simply don't subsample any more.
solve([R, Theta]).
Thanks in advance.
Can you verify this is clear for publishing? As in, the patent expired 20 years ago on the method, or, the original spec docs (or implementation) haven't been copied verbatim, or, enough to get legal in a tussle? Thanks in advance!
Hi!
I am not sure, but is this correct?
?- [X2, X3, X4]::real(0.01, 0.99), {X1 == (X2 + X3 - X2 * X3) * X4}, global_maximum(X1, MAX).
X2::real(0.5495054587018423, 0.9900000000000001),
X1:: 1.22761...,
MAX:: 1.22761...,
X4::real(0.7295252238616355, 0.9900000000000001),
X3::real(0.5495054587018423, 0.9900000000000001).
I am using clpBNR v0.9.3alpha
Kinds regards, JCR
Hi,
I used to work on BNR Prolog up to its last release in Nortel circa 1999. I have some experience I can share.
Hi,
I'm using CLP(BNR) for medical papers exploratory data reconstruction in my research.
How should I cite this library?
Thanks for writing this lib. Having active constraints over division etc. is a major improvement!
Cheers,
Raoul
Hi!
Not sure if this is a bug or limitation...
Running test
:
:-use_module(library(clpBNR)).
x1(X1):- X1::real(0.1, 0.9).
x2(X2):- X2::real(0.1, 0.9).
x3(X3):- X3::real(0.1, 0.9).
z(Z, OUT):-
x1(X1),
x2(X2),
x3(X3),
{Z == 1 - (abs(X1 - 1) + abs(X2 - 1) + abs(X3 + 1)) / 3},
OUT = [X1, X2, X3].
test:- z(Z, OUT), global_minimum(Z, _), maplist(writeln, OUT).
Yields:
_50{real(0.09999999999999999,0.10000228881835882)}
_92{real(0.09999999999999999,0.10000228881835882)}
_134{real(0.09999999999999999,0.9000000000000001)}
But shouldn't the last one be 0.9?
Kind regards, JCR
I am using swi-prolog 9.1.18 built from source with clpBNR 0.11.2 and have found a bug in the swi graphical debugger when attributed variables from clpBNR are shown.
The bug is triggered when trying to change the program current frame by clicking on select parent frame
or select child frame
or double clicking on a variable.
When trying to change the frame, the debugger will simply fail and when trying to portray a variable, the new window will be empty.
Here is a minimal reproducer:
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.18)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- use_module(library(clpBNR)).
% *** clpBNR v0.11.2 ***.
% Arithmetic global flags set to prefer rationals and IEEE continuation values.
true.
?- gtrace, X::real(0, 1), {Y == X * 2}.
% The graphical front-end will be used for subsequent tracing
ERROR: [Thread pce] Unhandled exception: nb_getval/2: variable `'clpBNR:bindings'' does not exist
X::real(0, 1),
Y::real(0, 2).
After the graphical debugger has launched, trace the program to go down 1 frame while having a clpBNR attributed variable shown and then try to go back up a frame.
You should see the exception appear.
Hello,
Thank you for this wonderful library.
I think I found a bug with 0 exponents.
?- use_module(library(clpBNR)).
% *** clpBNR v0.9.12alpha ***.
true.
?- {2**N==1}.
false.
?- {2**0==D}.
D = 1.
Let me know if you need more information.
And if I do:
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- debug(clpBNR).
Warning: clpBNR: no matching debug topic (yet)
true.
?- use_module(library(clpBNR)).
% *** clpBNR v0.9.12alpha ***.
true.
?- N::integer, {2**N==1}.
% Add {2**_10266{integer(-72057594037927936,72057594037927935)}==1}
[Thread 1]: failed to recover from global-overflow
C-stack trace labeled "out-of-stack":
[0] Sopen_string() at ??:? [0x7f93ffe94dd7]
[1] PL_get_long() at ??:? [0x7f93ffe63f59]
[2] PL_next_solution() at ??:? [0x7f93ffdb06da]
[3] PL_atom_generator_w() at ??:? [0x7f93ffd9e9d3]
[4] PL_check_data() at ??:? [0x7f93ffdeb221]
[5] PL_check_data() at ??:? [0x7f93ffdeb5cc]
[6] PL_toplevel() at ??:? [0x7f93ffe6e381]
[7] swipl(+0x10cd) [0x55a6fa4b60cd]
[8] __libc_start_call_main() at ??:? [0x7f93ffb64590]
[9] __libc_start_main_alias_2() at :? [0x7f93ffb64649]
[10] swipl(+0x1115) [0x55a6fa4b6115]
C-stack trace labeled "crash":
[0] Sopen_string() at ??:? [0x7f93ffe94dd7]
[1] PL_get_long() at ??:? [0x7f93ffe64767]
[2] PL_atom_generator_w() at ??:? [0x7f93ffd9e9d3]
[3] PL_check_data() at ??:? [0x7f93ffdeb221]
[4] PL_check_data() at ??:? [0x7f93ffdeb5cc]
[5] PL_toplevel() at ??:? [0x7f93ffe6e381]
[6] swipl(+0x10cd) [0x55a6fa4b60cd]
[7] __libc_start_call_main() at ??:? [0x7f93ffb64590]
[8] __libc_start_main_alias_2() at :? [0x7f93ffb64649]
[9] swipl(+0x1115) [0x55a6fa4b6115]
[FATAL ERROR: at Sat May 21 10:16:59 2022
Sorry, cannot continue]
[1] 458879 IOT instruction (core dumped) swipl
SWI-Prolog (threaded, 64 bits, version 9.1.10) % *** clpBNR v0.11.1 ***.
Dear Rick, a friend told gave me this small problem to implement : can prolog check if a given function is a "norm" or not. To be a norm, the function has to respect a couple of properties. The only one I started to implement is norm(a*X) = a * norm(X)
.
I know that Prolog is not the best language for theorem / math proving. Still, I though this could help him to find quickly counter-examples.
Saddly, I could not succeed. It looks like the not equal always fail.
Here is the code :
norm1(X, Y, N):-
X::real,
Y::real,
N::real,
{ N == abs(X - Y)}.
normNok(X, Y, N):-
X::real,
Y::real,
N::real,
{N == exp(X-Y)}.
my_norm_under_test(X, Y, N):- norm1(X, Y, N).
%my_norm_under_test(X, Y, N):- normNok(X, Y, N).
is_a_norm_test1(A, X, Y, N1, N2) :-
[A, X, Y, N1, N2]::real,
{AX == A * X, AY == A*Y},
my_norm_under_test(AX, AY, N1),
my_norm_under_test(X, Y, N2),
{AN2 == A*N2},
format("N1 = "), write(N1), format("~nN2 = "), write(N2), format("~nA*N2 = "), write(AN2), format("~n"),
{N1 == AN2}.
is_not_a_norm_test1(A, X, Y, N1, N2) :-
[A, X, Y, N1, N2]::real,
{AX == A * X, AY == A*Y},
my_norm_under_test(AX, AY, N1),
my_norm_under_test(X, Y, N2),
{AN2 == A*N2},
format("N1 = "), write(N1), format("~nN2 = "), write(N2), format("~nA*N2 = "), write(AN2), format("~n"),
{N1 <> AN2}.
norm1
is a function that respect the property. Whereas normNok
does not.
I can switch the norm to be tested by commenting / uncommenting the lines with my_norm_under_test
.
When I test norm1
, I have these outputs for these queries :
2 ?- is_a_norm_test1(0.5, 2.0, 3.0, N1, N2).
N1 = _12784{real(0.4999999999999989,0.5000000000000009)}
N2 = _12866{real(0.9999999999999991,1.0000000000000007)}
A*N2 = _18840{real(0.4999999999999995,0.5000000000000006)}
N1:: 0.50000000000000...,
N2:: 1.00000000000000... .
3 ?- is_not_a_norm_test1(0.5, 2.0, 3.0, N1, N2).
N1 = _24146{real(0.4999999999999989,0.5000000000000009)}
N2 = _24228{real(0.9999999999999991,1.0000000000000007)}
A*N2 = _29954{real(0.4999999999999995,0.5000000000000006)}
false.
It looks OK for me.
Now I switch to normNok
and here are the results I got from the queries :
5 ?- is_a_norm_test1(0.5, 2.0, 3.0, N1, N2).
N1 = _792{real(0.6065306597126328,0.6065306597126342)}
N2 = _874{real(0.367879441171442,0.3678794411714427)}
A*N2 = _6516{real(0.18393972058572097,0.18393972058572142)}
false.
6 ?- is_not_a_norm_test1(0.5, 2.0, 3.0, N1, N2).
N1 = _2876{real(0.6065306597126328,0.6065306597126342)}
N2 = _2958{real(0.367879441171442,0.3678794411714427)}
A*N2 = _8600{real(0.18393972058572097,0.18393972058572142)}
false.
Query number 5 fails. Which is fine because N1 <> A*N2
, so I cannot meet the constrain N1 == A*N2
.
So if query 5 fails, why query 6 also fails ?? Even in the console output, the intervals of N1 and A*N2 are really far away, so I cannot see why not equal fails.
I tried other NOK norms (e.g. log and cos). Similar behaviour. I tried to restrains reals to be within -1e3, 1e3 : same behaviour.
Can you help ?
This is not an urgent matter at all.
Thanks in advance
The "Older" syntax gives single-colons for attributed numbers e.g. where [_Y: real(1.732..., 1.732...)].
, which clashes with Prolog's module declaration (colon).
Rather than a double-colon, would it be ideal to write interval/R e.g. real(L,H)
declarations as a module (i.e. an interface), rather than with the double colon?
As an aside, I'm also considering using syntax such as Y⟦L,H⟧
(yes, UTF-8) to express interval notation in Prolog.
Hi!
Not sure if this a problem or not, but should the code below return the interval (1.21, 1.2100000000000006
)? The predicate below instead fails.
test:-
{X == 1.1 * 1.1},
numbervars(X, 0, _, [attvar(bind)]),
writeln(X).
Hi, ridgeworks.
I use windows 10.
When I run examples, it didn't work as expected.
Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- use_module(library(clpBNR)).
% *** clpBNR v0.9.7alpha ***.
true.
?- {2==X*X},solve(X).
X:: 1.414213562373095... .
?- {2==X*X}.
X::real(-1.4142135623730951, 1.4142135623730951).
?- {2==X*X, X < 0}.
false.
When I run?- {2==X*X},solve(X).
, X
has only one result. I didn't have a choice to type ;
.
When I run?- {2==X*X}.
, it worked as expected.
When I run?- {2==X*X, X < 0}.
, I got a false
.
When I run between(1,100,X),{X == Y*Y},findall(Y, solve(Y),List),length(List,Len),writeln([X,Len,List]),fail.
,
[1,2,[-1,1]]
[2,1,[_8118{real(1.414213562373095,1.4142135623730951)}]]
[3,1,[_8118{real(1.7320508075688772,1.7320508075688774)}]]
[4,2,[-2,2]]
[5,1,[_8118{real(2.2360679774997894,2.23606797749979)}]]
[6,2,[_8198{real(-2.4494897427831783,-2.449489742783178)},_8118{real(2.449489742783178,2.4494897427831783)}]]
[7,1,[_8118{real(2.6457513110645903,2.6457513110645907)}]]
[8,1,[_8118{real(2.82842712474619,2.8284271247461903)}]]
[9,2,[-3,3]]
[10,1,[_8118{real(3.162277660168379,3.1622776601683795)}]]
[11,2,[_8198{real(-3.3166247903554003,-3.3166247903554)},_8118{real(3.3166247903554,3.3166247903554003)}]]
[12,1,[_8118{real(3.4641016151377544,3.464101615137755)}]]
[13,2,[_8198{real(-3.6055512754639896,-3.605551275463989)},_8118{real(3.605551275463989,3.6055512754639896)}]]
[14,2,[_8198{real(-3.7416573867739418,-3.7416573867739413)},_8118{real(3.7416573867739413,3.7416573867739418)}]]
[15,1,[_8118{real(3.8729833462074166,3.872983346207417)}]]
[16,2,[-4,4]]
[17,1,[_8118{real(4.12310562561766,4.123105625617661)}]]
[18,2,[_8198{real(-4.242640687119286,-4.242640687119285)},_8118{real(4.242640687119285,4.242640687119286)}]]
[19,2,[_8198{real(-4.358898943540674,-4.358898943540673)},_8118{real(4.358898943540673,4.358898943540674)}]]
[20,1,[_8118{real(4.472135954999579,4.47213595499958)}]]
[21,2,[_8198{real(-4.582575694955841,-4.58257569495584)},_8118{real(4.58257569495584,4.582575694955841)}]]
[22,1,[_8118{real(4.690415759823429,4.69041575982343)}]]
[23,2,[_8198{real(-4.79583152331272,-4.795831523312719)},_8118{real(4.795831523312719,4.79583152331272)}]]
[24,2,[_8198{real(-4.898979485566357,-4.898979485566356)},_8118{real(4.898979485566356,4.898979485566357)}]]
[25,2,[-5,5]]
[26,2,[_8198{real(-5.099019513592785,-5.0990195135927845)},_8118{real(5.0990195135927845,5.099019513592785)}]]
[27,1,[_8118{real(5.196152422706631,5.196152422706632)}]]
[28,1,[_8118{real(5.2915026221291805,5.291502622129181)}]]
[29,2,[_8198{real(-5.385164807134505,-5.385164807134504)},_8118{real(5.385164807134504,5.385164807134505)}]]
[30,1,[_8118{real(5.47722557505166,5.477225575051661)}]]
[31,2,[_8198{real(-5.567764362830022,-5.5677643628300215)},_8118{real(5.5677643628300215,5.567764362830022)}]]
[32,1,[_8118{real(5.65685424949238,5.656854249492381)}]]
[33,2,[_8198{real(-5.7445626465380295,-5.744562646538029)},_8118{real(5.744562646538029,5.7445626465380295)}]]
[34,1,[_8118{real(5.8309518948453,5.830951894845301)}]]
[35,1,[_8118{real(5.916079783099615,5.916079783099616)}]]
[36,2,[-6,6]]
[37,1,[_8118{real(6.082762530298219,6.08276253029822)}]]
[38,1,[_8118{real(6.164414002968976,6.164414002968977)}]]
[39,1,[_8118{real(6.244997998398397,6.244997998398398)}]]
[40,1,[_8118{real(6.324555320336758,6.324555320336759)}]]
[41,2,[_8198{real(-6.403124237432849,-6.4031242374328485)},_8118{real(6.4031242374328485,6.403124237432849)}]]
[42,1,[_8118{real(6.4807406984078595,6.48074069840786)}]]
[43,2,[_8198{real(-6.557438524302001,-6.557438524302)},_8118{real(6.557438524302,6.557438524302001)}]]
[44,2,[_8198{real(-6.6332495807108005,-6.6332495807108)},_8118{real(6.6332495807108,6.6332495807108005)}]]
[45,1,[_8118{real(6.7082039324993685,6.708203932499369)}]]
[46,2,[_8198{real(-6.782329983125269,-6.782329983125268)},_8118{real(6.782329983125268,6.782329983125269)}]]
[47,2,[_8198{real(-6.855654600401045,-6.855654600401044)},_8118{real(6.855654600401044,6.855654600401045)}]]
[48,1,[_8118{real(6.928203230275509,6.92820323027551)}]]
[49,2,[-7,7]]
[50,1,[_8118{real(7.071067811865475,7.0710678118654755)}]]
[51,1,[_8118{real(7.1414284285428495,7.14142842854285)}]]
[52,2,[_8198{real(-7.211102550927979,-7.211102550927978)},_8118{real(7.211102550927978,7.211102550927979)}]]
[53,2,[_8198{real(-7.280109889280519,-7.280109889280518)},_8118{real(7.280109889280518,7.280109889280519)}]]
[54,1,[_8118{real(7.348469228349534,7.3484692283495345)}]]
[55,1,[_8118{real(7.416198487095662,7.416198487095663)}]]
[56,2,[_8198{real(-7.4833147735478835,-7.483314773547883)},_8118{real(7.483314773547883,7.4833147735478835)}]]
[57,1,[_8118{real(7.549834435270749,7.54983443527075)}]]
[58,1,[_8118{real(7.615773105863908,7.615773105863909)}]]
[59,2,[_8198{real(-7.681145747868609,-7.681145747868608)},_8118{real(7.681145747868608,7.681145747868609)}]]
[60,1,[_8118{real(7.745966692414833,7.745966692414834)}]]
[61,2,[_8198{real(-7.810249675906655,-7.810249675906654)},_8118{real(7.810249675906654,7.810249675906655)}]]
[62,1,[_8118{real(7.87400787401181,7.874007874011811)}]]
[63,1,[_8118{real(7.937253933193771,7.937253933193772)}]]
[64,2,[-8,8]]
[65,2,[_8198{real(-8.062257748298551,-8.06225774829855)},_8118{real(8.06225774829855,8.062257748298551)}]]
[66,1,[_8118{real(8.124038404635959,8.12403840463596)}]]
[67,1,[_8118{real(8.185352771872449,8.18535277187245)}]]
[68,1,[_8118{real(8.24621125123532,8.246211251235321)}]]
[69,1,[_8118{real(8.306623862918073,8.306623862918075)}]]
[70,1,[_8118{real(8.366600265340754,8.366600265340756)}]]
[71,1,[_8118{real(8.426149773176357,8.426149773176359)}]]
[72,2,[_8198{real(-8.485281374238571,-8.48528137423857)},_8118{real(8.48528137423857,8.485281374238571)}]]
[73,2,[_8198{real(-8.544003745317532,-8.54400374531753)},_8118{real(8.54400374531753,8.544003745317532)}]]
[74,2,[_8198{real(-8.602325267042628,-8.602325267042627)},_8118{real(8.602325267042627,8.602325267042628)}]]
[75,2,[_8198{real(-8.660254037844387,-8.660254037844386)},_8118{real(8.660254037844386,8.660254037844387)}]]
[76,2,[_8198{real(-8.717797887081348,-8.717797887081346)},_8118{real(8.717797887081346,8.717797887081348)}]]
[77,1,[_8118{real(8.77496438739212,8.774964387392123)}]]
[78,2,[_8198{real(-8.831760866327848,-8.831760866327846)},_8118{real(8.831760866327846,8.831760866327848)}]]
[79,2,[_8198{real(-8.88819441731559,-8.888194417315589)},_8118{real(8.888194417315589,8.88819441731559)}]]
[80,1,[_8118{real(8.944271909999157,8.94427190999916)}]]
[81,2,[-9,9]]
[82,1,[_8118{real(9.055385138137416,9.055385138137417)}]]
[83,1,[_8118{real(9.110433579144297,9.1104335791443)}]]
[84,2,[_8198{real(-9.165151389911681,-9.16515138991168)},_8118{real(9.16515138991168,9.165151389911681)}]]
[85,2,[_8198{real(-9.219544457292889,-9.219544457292887)},_8118{real(9.219544457292887,9.219544457292889)}]]
[86,1,[_8118{real(9.273618495495702,9.273618495495704)}]]
[87,1,[_8118{real(9.327379053088814,9.327379053088816)}]]
[88,1,[_8118{real(9.380831519646858,9.38083151964686)}]]
[89,2,[_8198{real(-9.433981132056605,-9.433981132056603)},_8118{real(9.433981132056603,9.433981132056605)}]]
[90,1,[_8118{real(9.486832980505136,9.486832980505138)}]]
[91,2,[_8198{real(-9.539392014169458,-9.539392014169456)},_8118{real(9.539392014169456,9.539392014169458)}]]
[92,2,[_8198{real(-9.59166304662544,-9.591663046625438)},_8118{real(9.591663046625438,9.59166304662544)}]]
[93,2,[_8198{real(-9.643650760992957,-9.643650760992955)},_8118{real(9.643650760992955,9.643650760992957)}]]
[94,1,[_8118{real(9.695359714832657,9.695359714832659)}]]
[95,2,[_8198{real(-9.746794344808965,-9.746794344808963)},_8118{real(9.746794344808963,9.746794344808965)}]]
[96,2,[_8198{real(-9.797958971132713,-9.797958971132712)},_8118{real(9.797958971132712,9.797958971132713)}]]
[97,2,[_8198{real(-9.848857801796106,-9.848857801796104)},_8118{real(9.848857801796104,9.848857801796106)}]]
[98,1,[_8118{real(9.899494936611664,9.899494936611665)}]]
[99,2,[_8198{real(-9.949874371066201,-9.9498743710662)},_8118{real(9.9498743710662,9.949874371066201)}]]
[100,2,[-10,10]]
false.
In some cases it cannot find the negative result .
A suggestion is to have some kind of output predicate that always has the same structure, no matter what the solution is.
In the current version, for example, if i do ?- {X==1/2}, X::DOM.
i get false
. But if i do ?-{X*X==2}
i get DOM = real(-1.4142135623730951, 1.4142135623730951)
. With these numbers it is easy to know what happens beforehand, but in other cases it might be unclear what unifies with X
.
Something like output(+X, -Variable, -Lower, -Upper, +PreferredNumberOfDecimals)
which given ?-{X == 1/2}, output(X, Variable, Lower, Upper, 3)
would yield Variable = _32424
, Lower = 0.500
, Upper = 0.500
.
Just a humble suggestion :-)
Thanks for porting clp(BNR)! I read that the documentation is work in progress at this point, but is there some place where i can find information about how to use global_maximum/2
and related predicates?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.