Yes, this is generated (I can't imagine how crazy one should be to type it by hand :-D) I used Python to generate the ECLiPSe program. I was very short on time (it was a programming contest) and I didn't feel confident enough to transform the data to constraints in ECLiPSe itself. In the end I solved this particular input (there were ten inputs from very small to this huge one) by generating a program for B-Prolog (while ECLiPSe was much faster for all other inputs, probably because of OSI CLP solver vs GLPK in B-Prolog). The task itself is really just a system of linear equations. For example, the simplest input was: 5 6 1.638 1.483 1.779 1.304 1.108 4 1 0.2955 1 2 0.479 1 3 0.2417 2 3 0.2139 4 5 0.451 4 3 0.0398 It means that there are 5 variables P1..P5 and 6 data lines describing relations between variables. So P1 = 1.638 + 0.0479 * P2 (corresponds to '1 2 0.479' in the input) + 0.02417 * P3 (corresponds to '1 3 0.2417') P2 = 1.483 + 0.2139 * P3 (corresponds '2 3 0.2139') etc. The original problem description can be found on the page 13 of http://ch24.org/static/archive/2013/2013_preec.pdf It can be assumed that the data is preprocessed to be easily read in Prolog: [5, 6]. [1.638, 1.483, 1.779, 1.304, 1.108]. [4, 1, 0.2955]. [1, 2, 0.479]. [1, 3, 0.2417]. [2, 3, 0.2139]. [4, 5, 0.451]. [4, 3, 0.0398]. The output (space-separated values of Ps) for the sample small input should be (the precision should be at least 1E-3): 2.9606142599 1.8635281 1.779 2.74937371380045 1.108 I would greatly appreciate if you can show how to solve the problem in ECLiPSe. Sergii. On Mon, Feb 18, 2013 at 2:45 PM, Joachim Schimpf <jschimpf_at_...311...> wrote: > On 18/02/2013 20:38, Sergii Dymchenko wrote: >> Hi, >> >> When try to load very large source file (almost 10 Mb) I get >> "Segmentation fault" error. >> >> Version 6.0 #199 (x86_64_linux), Fri Nov 2 22:47 2012 >> >> $ eclipse -g 5000000 -b R10.ecl >> Segmentation fault >> >> Is there some kind of hard limit on source file size? > > There is no limit on source file size. However, your file contains a > single big clause, and the parser chokes on that (which is due to the > hardware stack, and not affected by any ECLiPSe command line setting). > > Your clause is mainly a big conjunction of constraints, looking like: > > main :- > ... > P[1] $= 0.971700, > P[2] $= 1.797000 + P[37500] * 0.032760 + P[15936] * 0.005254 + ..., > ... > P[50000] $= 0.782900 + P[20370] * 0.400100 + P[31487] * 0.073090 + ..., > ... > > I assume you have generated this rather than typed it in ;) > > This program-generation technique seems very popular with our > users, but it is the wrong thing to do. In a programming language > like ECLiPSe, which supports metaprogramming, you never have to > generate a textual program. > > If the program that generates this clause is also written in > ECLiPSe, then it probably contains a loop like this > > ( for(I,1,50000) do > generate_constraint(I, Constraint), > write(Constraint), writeln(",") > ) > > The thing to do is to get rid of the intermediate file, and > execute each constraint as soon as you have generated it: > > ( for(I,1,50000) do > generate_constraint(I, Constraint), > call(Constraint) > ) > > In other words, just have a program that sets up the constraints > directly from your data files that contain the coefficients (or > wherever you get the numbers from). > > This of course only works if your program generator was already > written in ECLiPSe. If not (and you don't want to rewrite it > in ECLiPSe), let me know, and I'll suggest another technique! > > > -- Joachim > > ------------------------------------------------------------------------------ > The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, > is your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials, tech docs, > whitepapers, evaluation guides, and opinion stories. Check out the most > recent posts - join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECLiPSe-CLP-Users_at_lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-usersReceived on Mon Feb 18 2013 - 23:34:14 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST