clp(q) interactive vs. stand-alone behaviour
- From: Andrey Rybalchenko <first.last@xxxxxxx>
- Date: Fri, 11 Aug 2006 16:53:09 +0200
Dear group,
I'm struggling with a strange behavior of sicstus clp(q) solver. Its (correct) answer in interactive mode is correct and differs from an (incorrect )answer in a stand-alone program.
In stand-alone program, main.pl shown below produces:
DVars [1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1]
Similarly, swi clp(q) solver computes (again an incorrect answer)
DVars
[1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0]
In sicstus interpreter:
DVars [0,0,0,0,1,1,1,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1]
Correctness is checked by the following procedure:
check(Anser) :-
Cs = ...,
D = ...,
term_variables(D, DVars),
DVars = Answer,
Cs.
Any ideas?
Best regards,
Andrey
PS: my setup
-------------------------- begin make-test-sav.pl
:- compile('main.pl').
:- save_program('test').
:- halt.
-------------------------- end make-test-sav.pl
-------------------------- begin Makefile
test: test.sav
spld --output="test" --main=restore --moveable --static --resources-from-sav --resources=test.sav=/test/test.sav
test.sav: main.pl
sicstus -l make-test-sav.pl
chmod -x test.sav
clean:
rm -f *.sav
-------------------------- end Makefile
-------------------------- begin main.pl
:- use_module(library(clpq)).
:- use_module(library(terms)).
query :-
Cs = {(_56904>=0,_56902>=0,_56900>=0,1=1),_56904* -1+_56902*_417+_56900*_415=< -1+(0*0+0*0+0*0+0*0),(0*_56904+_413*_56902+_403*_56900=1*0+0*0+0*0+0*0,1*_56904+_411*_56902+_401*_56900=0*0+1*0+0*0+0*0,0*_56904+_409*_56902+_399*_56900=0*0+0*0+1*0+0*0,0*_56904+_407*_56902+_397*_56900=0*0+0*0+0*0+1*0,1=1),(_55771>=0,_55769>=0,_55767>=0,1=1),_55771* -1+_55769*_417+_55767*_415=< -1+(0*0+0*0+0*0+0*0),(0*_55771+_413*_55769+_403*_55767=1*0+0*0+0*0+0*0,1*_55771+_411*_55769+_401*_55767=0*0+1*0+0*0+0*0,0*_55771+_409*_55769+_399*_55767=0*0+0*0+1*0+0*0,0*_55771+_407*_55769+_397*_55767=0*0+0*0+0*0+1*0,1=1),(_25862>=0,_25860>=0,1=1),_25862*_487+_25860*_485=<_379+(0*_375+0*_373+ -1*_371+0*_369),(_483*_25862+_473*_25860=1*_375+0*_373+0*_371+0*_369,_481*_25862+_471*_25860=0*_375+1*_373+0*_371+0*_369,_479*_25862+_469*_25860=0*_375+0*_373+1*_371+0*_369,_477*_25862+_467*_25860=0*_375+0*_373+0*_371+1*_369,1=1),(_24888>=0,_24886>=0,1=1),_24888*_487+_24886*_485=<_377+(0*_365+0*_363+ -1*_361+0*_359),(_483*_24888+_473*_24886=1*_365+0*_363+0*_361+0*_359,_481*_24888+_471*_24886=0*_365+1*_363+0*_361+0*_359,_479*_24888+_469*_24886=0*_365+0*_363+1*_361+0*_359,_477*_24888+_467*_24886=0*_365+0*_363+0*_361+1*_359,1=1),(_5791>=0,_5789>=0,1=1),_5791*_449+_5789*_447=<_487+(0*_483+1*_481+0*_479+0*_477),(_445*_5791+_435*_5789=1*_483+0*_481+0*_479+0*_477,_443*_5791+_433*_5789=0*_483+1*_481+0*_479+0*_477,_441*_5791+_431*_5789=0*_483+0*_481+1*_479+0*_477,_439*_5791+_429*_5789=0*_483+0*_481+0*_479+1*_477,1=1),(_5658>=0,_5656>=0,1=1),_5658*_449+_5656*_447=<_485+(0*_473+1*_471+0*_469+0*_467),(_445*_5658+_435*_5656=1*_473+0*_471+0*_469+0*_467,_443*_5658+_433*_5656=0*_473+1*_471+0*_469+0*_467,_441*_5658+_431*_5656=0*_473+0*_471+1*_469+0*_467,_439*_5658+_429*_5656=0*_473+0*_471+0*_469+1*_467,1=1),(_5250>=0,_5248>=0,_5246>=0,1=1),_5250*0+_5248*_417+_5246*_415=<_449+(0*_445+0*_443+0*_441+0*_439),(0*_5250+_413*_5248+_403*_5246=1*_445+0*_443+0*_441+0*_439, -1*_5250+_411*_5248+_401*_5246=0*_445+1*_443+0*_441+0*_439,0*_5250+_409*_5248+_399*_5246=0*_445+0*_443+1*_441+0*_439,0*_5250+_407*_5248+_397*_5246=0*_445+0*_443+0*_441+1*_439,1=1),(_5077>=0,_5075>=0,_5073>=0,1=1),_5077*0+_5075*_417+_5073*_415=<_447+(0*_435+0*_433+0*_431+0*_429),(0*_5077+_413*_5075+_403*_5073=1*_435+0*_433+0*_431+0*_429, -1*_5077+_411*_5075+_401*_5073=0*_435+1*_433+0*_431+0*_429,0*_5077+_409*_5075+_399*_5073=0*_435+0*_433+1*_431+0*_429,0*_5077+_407*_5075+_397*_5073=0*_435+0*_433+0*_431+1*_429,1=1),(_4661>=0,_4659>=0,_4657>=0,1=1),_4661* -1+_4659*_379+_4657*_377=<_417+(0*_413+0*_411+0*_409+0*_407),( -1*_4661+_375*_4659+_365*_4657=1*_413+0*_411+0*_409+0*_407,0*_4661+_373*_4659+_363*_4657=0*_413+1*_411+0*_409+0*_407,1*_4661+_371*_4659+_361*_4657=0*_413+0*_411+1*_409+0*_407,0*_4661+_369*_4659+_359*_4657=0*_413+0*_411+0*_409+1*_407,1=1),(_4494>=0,_4492>=0,_4490>=0,1=1),_4494* -1+_4492*_379+_4490*_377=<_415+(0*_403+0*_401+0*_399+0*_397),( -1*_4494+_375*_4492+_365*_4490=1*_403+0*_401+0*_399+0*_397,0*_4494+_373*_4492+_363*_4490=0*_403+1*_401+0*_399+0*_397,1*_4494+_371*_4492+_361*_4490=0*_403+0*_401+1*_399+0*_397,0*_4494+_369*_4492+_359*_4490=0*_403+0*_401+0*_399+1*_397,1=1),(_4113>=0,_4111>=0,1=1),_4113*_335+_4111*_333=<_379+(0*_375+0*_373+0*_371+0*_369),(_331*_4113+_321*_4111=1*_375+0*_373+0*_371+0*_369,_329*_4113+_319*_4111=0*_375+1*_373+0*_371+0*_369,_327*_4113+_317*_4111=0*_375+0*_373+0*_371+0*_369,_325*_4113+_315*_4111=0*_375+0*_373+0*_371+1*_369,1=1),(_3980>=0,_3978>=0,1=1),_3980*_335+_3978*_333=<_377+(0*_365+0*_363+0*_361+0*_359),(_331*_3980+_321*_3978=1*_365+0*_363+0*_361+0*_359,_329*_3980+_319*_3978=0*_365+1*_363+0*_361+0*_359,_327*_3980+_317*_3978=0*_365+0*_363+0*_361+0*_359,_325*_3980+_315*_3978=0*_365+0*_363+0*_361+1*_359,1=1),(_3578>=0,_3576>=0,_3574>=0,1=1),_3578*0+_3576*_233+_3574*_231=<_335+(0*_331+0*_329+0*_327+0*_325),(1*_3578+_229*_3576+_219*_3574=1*_331+0*_329+0*_327+0*_325,0*_3578+_227*_3576
+_217*_3574=0*_331+1*_329+0*_327+0*_325,0*_3578+_225*_3576+_215*_3574=0*_331+0*_329+1*_327+0*_325, -1*_3578+_223*_3576+_213*_3574=0*_331+0*_329+0*_327+1*_325,1=1),(_3405>=0,_3403>=0,_3401>=0,1=1),_3405*0+_3403*_233+_3401*_231=<_333+(0*_321+0*_319+0*_317+0*_315),(1*_3405+_229*_3403+_219*_3401=1*_321+0*_319+0*_317+0*_315,0*_3405+_227*_3403+_217*_3401=0*_321+1*_319+0*_317+0*_315,0*_3405+_225*_3403+_215*_3401=0*_321+0*_319+1*_317+0*_315, -1*_3405+_223*_3403+_213*_3401=0*_321+0*_319+0*_317+1*_315,1=1),(_3024>=0,_3022>=0,1=1),_3024*_303+_3022*_301=<_233+(0*_229+0*_227+0*_225+ -1*_223),(_299*_3024+_289*_3022=1*_229+0*_227+0*_225+0*_223,_297*_3024+_287*_3022=0*_229+1*_227+0*_225+0*_223,_295*_3024+_285*_3022=0*_229+0*_227+1*_225+0*_223,_293*_3024+_283*_3022=0*_229+0*_227+0*_225+1*_223,1=1),(_2891>=0,_2889>=0,1=1),_2891*_303+_2889*_301=<_231+(0*_219+0*_217+0*_215+ -1*_213),(_299*_2891+_289*_2889=1*_219+0*_217+0*_215+0*_213,_297*_2891+_287*_2889=0*_219+1*_217+0*_215+0*_213,_295*_2891+_285*_2889=0*_219+0*_217+1*_215+0*_213,_293*_2891+_283*_2889=0*_219+0*_217+0*_215+1*_213,1=1),(_2521>=0,_2519>=0,1=1),_2521*_271+_2519*_269=<_303+(0*_299+ -1*_297+0*_295+0*_293),(_267*_2521+_257*_2519=1*_299+0*_297+0*_295+0*_293,_265*_2521+_255*_2519=0*_299+1*_297+0*_295+0*_293,_263*_2521+_253*_2519=0*_299+0*_297+1*_295+0*_293,_261*_2521+_251*_2519=0*_299+0*_297+0*_295+1*_293,1=1),(_2394>=0,_2392>=0,1=1),_2394*_271+_2392*_269=<_301+(0*_289+ -1*_287+0*_285+0*_283),(_267*_2394+_257*_2392=1*_289+0*_287+0*_285+0*_283,_265*_2394+_255*_2392=0*_289+1*_287+0*_285+0*_283,_263*_2394+_253*_2392=0*_289+0*_287+1*_285+0*_283,_261*_2394+_251*_2392=0*_289+0*_287+0*_285+1*_283,1=1),(_1986>=0,_1984>=0,_1982>=0,1=1),_1986* -1+_1984*_233+_1982*_231=<_271+(0*_267+0*_265+0*_263+0*_261),( -1*_1986+_229*_1984+_219*_1982=1*_267+0*_265+0*_263+0*_261,0*_1986+_227*_1984+_217*_1982=0*_267+1*_265+0*_263+0*_261,0*_1986+_225*_1984+_215*_1982=0*_267+0*_265+1*_263+0*_261,1*_1986+_223*_1984+_213*_1982=0*_267+0*_265+0*_263+1*_261,1=1),(_1813>=0,_1811>=0,_1809>=0,1=1),_1813* -1+_1811*_233+_1809*_231=<_269+(0*_257+0*_255+0*_253+0*_251),( -1*_1813+_229*_1811+_219*_1809=1*_257+0*_255+0*_253+0*_251,0*_1813+_227*_1811+_217*_1809=0*_257+1*_255+0*_253+0*_251,0*_1813+_225*_1811+_215*_1809=0*_257+0*_255+1*_253+0*_251,1*_1813+_223*_1811+_213*_1809=0*_257+0*_255+0*_253+1*_251,1=1),(_1432>=0,_1430>=0,1=1),_1432*_201+_1430*_199=<_233+(0*_229+0*_227+0*_225+0*_223),(_197*_1432+_187*_1430=1*_229+0*_227+0*_225+0*_223,_195*_1432+_185*_1430=0*_229+1*_227+0*_225+0*_223,_193*_1432+_183*_1430=0*_229+0*_227+1*_225+0*_223,_191*_1432+_181*_1430=0*_229+0*_227+0*_225+0*_223,1=1),(_1305>=0,_1303>=0,1=1),_1305*_201+_1303*_199=<_231+(0*_219+0*_217+0*_215+0*_213),(_197*_1305+_187*_1303=1*_219+0*_217+0*_215+0*_213,_195*_1305+_185*_1303=0*_219+1*_217+0*_215+0*_213,_193*_1305+_183*_1303=0*_219+0*_217+1*_215+0*_213,_191*_1305+_181*_1303=0*_219+0*_217+0*_215+0*_213,1=1),(_941>=0,_939>=0,1=1),_941*1+_939*1=<_201+(0*_197+0*_195+0*_193+0*_191),(0*_941+0*_939=1*_197+0*_195+0*_193+0*_191,0*_941+0*_939=0*_197+0*_195+0*_193+0*_191,0*_941+0*_939=0*_19
7+0*_195+1*_193+0*_191,0*_941+0*_939=0*_197+0*_195+0*_193+1*_191,1=1),(_814>=0,_812>=0,1=1),_814*1+_812*1=<_199+(0*_187+0*_185+0*_183+0*_181),(0*_814+0*_812=1*_187+0*_185+0*_183+0*_181,0*_814+0*_812=0*_187+0*_185+0*_183+0*_181,0*_814+0*_812=0*_187+0*_185+1*_183+0*_181,0*_814+0*_812=0*_187+0*_185+0*_183+1*_181,1=1)},
D = {(_56904=1;_56904=0),(_56902=1;_56902=0),(_56900=1;_56900=0),(_55771=1;_55771=0),(_55769=1;_55769=0),(_55767=1;_55767=0),(_25862=1;_25862=0),(_25860=1;_25860=0),(_24888=1;_24888=0),(_24886=1;_24886=0),(_5791=1;_5791=0),(_5789=1;_5789=0),(_5658=1;_5658=0),(_5656=1;_5656=0),(_5250=1;_5250=0),(_5248=1;_5248=0),(_5246=1;_5246=0),(_5077=1;_5077=0),(_5075=1;_5075=0),(_5073=1;_5073=0),(_4661=1;_4661=0),(_4659=1;_4659=0),(_4657=1;_4657=0),(_4494=1;_4494=0),(_4492=1;_4492=0),(_4490=1;_4490=0),(_4113=1;_4113=0),(_4111=1;_4111=0),(_3980=1;_3980=0),(_3978=1;_3978=0),(_3578=1;_3578=0),(_3576=1;_3576=0),(_3574=1;_3574=0),(_3405=1;_3405=0),(_3403=1;_3403=0),(_3401=1;_3401=0),(_3024=1;_3024=0),(_3022=1;_3022=0),(_2891=1;_2891=0),(_2889=1;_2889=0),(_2521=1;_2521=0),(_2519=1;_2519=0),(_2394=1;_2394=0),(_2392=1;_2392=0),(_1986=1;_1986=0),(_1984=1;_1984=0),(_1982=1;_1982=0),(_1813=1;_1813=0),(_1811=1;_1811=0),(_1809=1;_1809=0),(_1432=1;_1432=0),(_1430=1;_1430=0),(_1305=1;_1305=0),(_1303=1;_1303=
0),(_941=1;_941=0),(_939=1;_939=0),(_814=1;_814=0),(_812=1;_812=0),1=1},
term_variables(D, DVars), Cs, D, format('DVars ~p\n', [DVars]).
user:runtime_entry(start) :-
print('hello world\n'),
query.
-------------------------- end main.pl
.
- Follow-Ups:
- Re: clp(q) interactive vs. stand-alone behaviour
- From: Tom Schrijvers
- Re: clp(q) interactive vs. stand-alone behaviour
- Prev by Date: Re: bug in clp(q,r) library
- Next by Date: Re: When to use facts instead of rules?
- Previous by thread: bug in clp(q,r) library
- Next by thread: Re: clp(q) interactive vs. stand-alone behaviour
- Index(es):