--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.
I am surprised to have found that my “sat_count” terminates for the problem(8, R) before the Tokyo 2020.For now, I only hope the result is correct.%@ R = 185794560.% ?- problem(8, P), profile(time(solc(P, R))).%@ % 55,679,808,628 inferences, 203331.156 CPU in 204389.336 seconds (99% CPU, 273838 Lips)%@ P = (#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false))))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))*((#(*)=:=true)*((#(*)=:=false)*(#(*)=:=false))*((#(*)=:=true)*(#(*)=:=false)*(#(*)=:=true))))))),%@ R = 185794560.I feel my codes somewhat ad-hoc about hashing. I will readabout the recent assoc library of SWI to replace the ad-hoc hashing with“assoc” if it is better for my purpose.Kuniaki Mukai.
On Jan 29, 2018, at 5:26, Harry Stoteles <in...@xlog.ch> wrote:
>>>> <mailto:swi-prolog+unsub...@googlegroups.com><mailto:swi-prolog+...@googlegroups.com>.
>>>> Visit this group athttps://groups.google.com/group/swi-prolog.
>>>> For more options, visithttps://groups.google.com/d/optout.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "SWI-Prolog" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email toswi-prolog...@googlegroups.com
>>> <mailto:swi-prolog+unsub...@googlegroups.com><mailto:swi-prolog+...@googlegroups.com>.
>>> Visit this group athttps://groups.google.com/group/swi-prolog.
>>> For more options, visithttps://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+unsub...@googlegroups.com>.
/** Cache the hash code for the string */So rehashing strings is especially cheap, since you readily
private int hash; // Default to 0
size++;
if (size > table.length * 3 / 4)
resize(table.length * 2);
static final int TREEIFY_THRESHOLD = 8;Quite complex code meanwhile:
static final int UNTREEIFY_THRESHOLD = 6;
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/HashMap.java/
static final float DEFAULT_LOAD_FACTOR = 0.75f;
Kuniaki Mukai wrote:> Possible input key X is limited to only the following three simple key terms.> 1. if(X, I, J)> 2. meet(I, J)> 3. sum(I, J)
So I and J are trees?
--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
On Jan 31, 2018, at 20:32, Harry Stoteles <in...@xlog.ch> wrote:> 2. meet(I, J)> 3. sum(I, J)
Maybe order arguments. Only compute meet or sum,
when I<J. Don't need to compute meet(I, J) and meet(J, I).
--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.
Cheers --- Jan
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
On Feb 1, 2018, at 10:04, Harry Stoteles <in...@xlog.ch> wrote:What you mean by "keeping track of insertion order so that
iteration is deterministic", I don't understand completely.
There are hash table variants, with extra list overlayed,
so that the input order is preserved, in Java its called
https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html
If you then iterate over the input order overlay, you
get the input order back. Without an input order overlay,
a hash table spills out the elements in a kind of garbage
order, thats true. If you want a different order, you
can use a tree with some comparator, or the linked
hash table, which will give you back the input order.
Am Donnerstag, 1. Februar 2018 01:59:10 UTC+1 schrieb Harry Stoteles:The python link describes an interesting hash table variant.
"open adressing". I guess it doesn't make the hash table faster,
| If multiple TrailAssignment() calls happen on the same address within a |
| choicepoint we only need to keep the first. Therefore we scan the trail |
| for this choicepoint from the mark to the top and mark (using the FIRST |
| mark) the (global stack) addresses trailed. If we find one marked we can |
| delete the trail entry. To avoid a second scan we store the marked |
> <mailto:swi-prolog+unsub...@googlegroups.com>.
On Feb 1, 2018, at 19:49, Harry Stoteles <in...@xlog.ch> wrote:On solution would be to use nb_setarg for the hash ops, and
only a global backtracking once, when you enter solc.
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)If the specified key is not already associated with a
null), attempts to compute its null.
On Feb 1, 2018, at 23:45, Harry Stoteles <in...@xlog.ch> wrote:
On Feb 1, 2018, at 23:45, Harry Stoteles <in...@xlog.ch> wrote:
On Feb 2, 2018, at 19:44, Harry Stoteles <in...@xlog.ch> wrote:Probably you don't need a cache search at all. Did you ever measure the
number of cache hits and the number of cache misses.
?- dim(6,6,X), time((basis(X,E), expr_tree(E,T), expr_vars(T, N, _))). % Up 2,150 ms, GC 166 ms, Thread Cpu 1,954 ms (Current 02/02/18 22:48:40) N = 23040
?- dim(7,7,X), time((basis(X,E), expr_tree(E,T), expr_vars(T, N, _))). Error: Execution aborted since memory threshold exceeded.
I made a quick comparison between hash and assoc.The result says hash is about two times faster than assoc.[assoc]% ?- profile((problem(6, P), time(solc(P, R)))).%@ % 35,183,129 inferences, 5.803 CPU in 5.836 seconds (99% CPU, 6062986 Lips)%@ R = 23040.[hash]%@ % 12,924,098 inferences, 1.880 CPU in 1.907 seconds (99% CPU, 6875749 Lips)%@ R = 23040.[assoc]% ?- profile((problem(7, P), time(solc(P, R)))).%@ % 801,611,011 inferences, 144.847 CPU in 145.890 seconds (99% CPU, 5534193 Lips)%@ R = 1451520.[hash]% ?- profile((problem(7, P), time(solc(P, R)))).%@ % 213,707,830 inferences, 71.280 CPU in 72.431 seconds (98% CPU, 2998141 Lips)%@ R = 1451520.library(assoc) is easy to use, so I like it. On the other hand, a hash wayis not easy for me to find a suitable size of the hash table and the depth parameterfor term_hash/4. I feel like Buridan's ass for now, which way to go.Kuniaki MukaiI am surprised to have found that my “sat_count” terminates for the problem(8, R) before the Tokyo 2020.For now, I only hope the result is correct.%@ R = 185794560.% ?- problem(8, P), profile(time(solc(P, R))).%@ % 55,679,808,628 inferences, 203331.156 CPU in 204389.336 seconds (99% CPU, 273838 Lips)%@ P = (#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false))))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false))))*((#(*)=:=true)*((#(*)=:=false)*((#(*)=:=false)*(#(*)=:=false)))*((#(*)=:=true)*((#(*)=:=false)*(#(*)=:=false))*((#(*)=:=true)*(#(*)=:=false)*(#(*)=:=true))))))),%@ R = 185794560.I feel my codes somewhat ad-hoc about hashing. I will readabout the recent assoc library of SWI to replace the ad-hoc hashing with“assoc” if it is better for my purpose.Kuniaki Mukai.On Jan 29, 2018, at 5:26, Harry Stoteles <in...@xlog.ch> wrote:Well you could use the SWI menu item "run | new thread". It will
then show a new window with something like:
SWI-Prolog console for thread 3
?-
And then you could open 4 such windows, and start the same
problem, but with different labeling:
Console 1: label([0,0|...])
Console 2: label([0,1|...])
Console 3: label([1,0|...])
Console 4: label([1,1|...])
If you see library(clpb) or SWI crashing, you might need to
file a bug report, which could delay the goal of Tokyo Japan 2020.
Am Sonntag, 28. Januar 2018 11:42:59 UTC+1 schrieb Kuniaki Mukai:Hi Jan,
Thanks for reply. It is interesting that thread programming could control
multi-cores.
I am running my codes “sat_count” on the “notable” benchmark problem(8,_) for ROZDD of Jan Burse
for almost one day long after slightly modifying on hashing. It is still running… Now I am
afraid it keeps running till the next Olympic Game at Tokyo Japan 2020. According to
Activity monitor, it uses always only one core out of 4; the other three are idling. So I asked
the question. Unfortunately, for my problem, multi-core programming seems not appropriate because it is difficult
to divide the codes into independents parts.
Kuniaki Mukai
> On Jan 28, 2018, at 18:14, Jan Wielemaker <j...@swi-prolog.org> wrote:
>
> On 28/01/18 07:19, Kuniaki Mukai wrote:
>> Hi,
>> Is there a simple way to run a SWI-Prolog program on multi-core
>> machine (e.g. iMac with 4 cores). Am I asking a difficult question
>> which should not be asked easily here ?
>
> Not really sure what you mean. SWI-Prolog runs fine on multi-core
> hardware as you probably know. If you actually want to profit, you
> have to use thHie thread predicates. These create multiple solvers
> on a shared program. This model is not very useful to compute on a
> large data structure. It mostly aims at servers or the need to
> execute many small and (mostly) independent tasks.
>
> Cheers --- Jan
?- card(2,[X,X,Y,Z]), labeling([X,Y,Z]),Yeah!
write(X-Y-Z), nl, fail; true. 0-1-1 1-0-0
?- dim(6,6,X), time((basis(X,E), expr_tree(E,T))), nl, fail; true.
% Up 1,194 ms, GC 0 ms, Thread Cpu 1,188 ms (Current 02/04/18 14:15:51)
?- dim(6,6,X), time((basis(X,E), expr_tree(E,T), tree_count(T,_,N))).With slicing I get these timings:
% Up 2,161 ms, GC 243 ms, Thread Cpu 1,922 ms (Current 02/04/18 14:13:29)
23040
?- dim(6,6,X), term_variables(X,[A,B|_]), time((labeling([A,B]),
basis(X,E), expr_tree(E,T))). % Up 910 ms, GC 142 ms, Thread Cpu 766 ms (Current 02/04/18 14:19:22) % Up 962 ms, GC 0 ms, Thread Cpu 969 ms (Current 02/04/18 14:19:23) % Up 1,071 ms, GC 102 ms, Thread Cpu 968 ms (Current 02/04/18 14:19:24) % Up 970 ms, GC 0 ms, Thread Cpu 969 ms (Current 02/04/18 14:19:25) % Up 205 ms, GC 0 ms, Thread Cpu 203 ms (Current 02/04/18 14:19:25) Yes
?- dim(6,6,X), term_variables(X,[A,B|_]), time((labeling([A,B]),
basis(X,E), expr_tree(E,T), tree_count(T,_,N))). % Up 946 ms, GC 0 ms, Thread Cpu 937 ms (Current 02/04/18 14:23:37) 5760 % Up 1,365 ms, GC 227 ms, Thread Cpu 1,157 ms (Current 02/04/18 14:23:39) 5760 % Up 1,359 ms, GC 242 ms, Thread Cpu 1,109 ms (Current 02/04/18 14:23:40) 5760 % Up 1,090 ms, GC 0 ms, Thread Cpu 1,094 ms (Current 02/04/18 14:23:41) 5760 % Up 212 ms, GC 0 ms, Thread Cpu 218 ms (Current 02/04/18 14:23:41) Yes
Oops, you don't use CLP(B), maybe doing somewhere:
Console 1: X=0, Y=0
Console 2: X=0, Y=1
Console 3: X=1, Y=0
Console 4: X=1, Y=1
Might slice the search.
Hi Harry,problem(6), problem(7), … are all blackboxes for me. I have no idea in them.In fact, they are just copies from Jan Burse for a benchmark test.So I am not able to to reply your questions. Sorry for that.I have not a lot of work on rozdd, but just a little bit of a hobbyist effort to understandthe notion rozdd within SWI-Prolog programming.IMHO, an efficient library to manipulate rozdd should be prepared in SWI.Although we have already a nice and great clpb library, rozdd is hidden behindattributed variables and boolean constraints, which of course is an excellent idea of Markus T. usingfamiliar boolean form for interface.M., Kuniaki
On Feb 27, 2018, at 8:53, Harry Stoteles <in...@xlog.ch> wrote:
On Feb 27, 2018, at 18:46, Harry Stoteles <in...@xlog.ch> wrote:What do the numbers on the edges mean?