I can't seem to get a hash table to update when used inside a do loop inside a minimize goal. The hash remains empty. I'm running version 5.10 #77 on windows. Any ideas?Thanks,David Sample Code: :- lib(hash).:- lib(ic).:- lib(branch_and_bound). test_hash(Keys, Values) :- List = [1, 2, 3], minimize( ( X :: 1 .. 10, indomain(X), Y #= -X, hash_create(TheHash), ( foreach(Key, List), param(TheHash) do Val is 2 * Key, hash_set(TheHash, Key, Val), hash_list(TheHash, Keys, Values), hash_count(TheHash, Count), printf("Hash contents in loop %w %w size %w\n", [Keys, Values, Count]) ), hash_list(TheHash, Keys, Values), hash_count(TheHash, Count), printf("Hash contents after loop %w %w size %w\n", [Keys, Values, Count]), hash_list(TheHash, Keys, Values) ), Y ), printf( "X %w Y %w\n", [X, Y] ). Execution: ?- test_hash(Keys, Values).Keys = []Values = []Yes (0.02s cpu) Output: Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -1Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -2Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -3Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -4Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -5Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -6Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -7Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -8Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -9Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents in loop [] [] size 0Hash contents after loop [] [] size 0Found a solution with cost -10Found no solution with cost -1.0Inf .. -11X 10 Y -10 _________________________________________________________________ PC Magazine’s 2007 editors’ choice for best web mail—award-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HMWL_mini_pcmag_0707Received on Wed Jul 11 2007 - 22:23:30 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET