Hello all,<br><br>The problem is not with the code, but that population_monitor should not be started with start(). Population_monitor should be started with the properly set up constraints. To use the default constraints you start with population_monitor:test(). <br>
test()-><br> init_population(#state{op_mode = [gt,benchmark]},?INIT_CONSTRAINTS).<br>%The test/0 function starts the population monitor through init_population/1 with a set of default parameters specified by the macros of this module.<br>
<br>prep_PopState(PMP,Specie_Constraints)-><br> S=#state{<br> op_mode=PMP#pmp.op_mode,<br> population_id = PMP#pmp.population_id,<br> survival_percentage=PMP#pmp.survival_percentage,<br> specie_size_limit=PMP#pmp.specie_size_limit,<br>
init_specie_size=PMP#pmp.init_specie_size,<br> polis_id=PMP#pmp.polis_id,<br> generation_limit=PMP#pmp.generation_limit,<br> evaluations_limit=PMP#pmp.evaluations_limit,<br> fitness_goal=PMP#pmp.fitness_goal,<br>
benchmarker_pid=PMP#pmp.benchmarker_pid<br> },<br> init_population(S,Specie_Constraints).<br><br>init_population(Init_State,Specie_Constraints)-><br> random:seed(now()),<br> Population_Id = Init_State#state.population_id,<br>
%OpMode = Init_State#state.op_mode,<br> F = fun()-><br> case genotype:read({population,Population_Id}) of<br> undefined -><br> create_Population(Population_Id,Init_State#state.init_specie_size,Specie_Constraints);<br>
_ -><br> delete_population(Population_Id),<br> create_Population(Population_Id,Init_State#state.init_specie_size,Specie_Constraints)<br> end<br> end,<br> Result = mnesia:transaction(F),<br>
case Result of<br> {atomic,_} -><br> population_monitor:start(Init_State);<br> Error -><br> io:format("******** ERROR in PopulationMonitor:~p~n",[Error])<br> end.<br>
%The function init_population/1 creates a new population with the id Population_Id, composed of length(Specie_Constraints) species, where each specie uses the particular specie constraint specified within the Specie_Constraints list. The function first checks if a population with the noted Population_Id already exists, if a population does exist, then the function first delets it, and then creates a fresh one. Since the ids are usually generated with the genotype:create_UniqueId/0, the only way an already existing Population_Id is dropped into the function as a parameter is if it is intended, usually when runing tests, with the Population_Id = test.<br>
<br>You will note that population_monitor;start(Init_state) is the only way to properly start the population monitor. I did not wish to remove the function population_monitor:start() from the module, for the sake of future extensions. But there are no problems with the code.<br>
<br>Best regards,<br>-Gene<br><br><div class="gmail_quote">On Mon, Dec 24, 2012 at 4:35 AM, OJ Reeves <span dir="ltr"><<a href="mailto:oj@buffered.io" target="_blank">oj@buffered.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All,<div><br></div><div>The first issue is that the init() function isn't correct for this gen_server.</div><div><br></div><div>On line 83, the init function starts like this:</div><div>init(S) -></div><div>When it should (apparently) be like this:</div>
<div>init([S]) -></div><div><br></div><div>This doesn't make the server run though. The next error states:</div><div><br></div><div><div>6> population_monitor:start().</div><div>******** Population monitor started with parameters:{state,</div>
<div> [gt],</div><div> test,[],[],undefined,</div><div> undefined,undefined,[],0,</div>
<div> 0,0,0,0,undefined,</div><div> undefined,undefined,</div><div> undefined,undefined,</div>
<div> undefined,0.5,10,10,</div><div> mathema,100,100000,inf,</div><div> undefined,false}</div>
<div>{error,{{badrecord,population},</div><div> [{population_monitor,extract_AgentIds,2,</div><div> [{file,"population_monitor.erl"},{line,372}]},</div><div> {population_monitor,init,1,</div>
<div> [{file,"population_monitor.erl"},{line,89}]},</div><div class="im"><div> {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},</div><div> {proc_lib,init_p_do_apply,3,</div>
<div> [{file,"proc_lib.erl"},{line,227}]}]}}</div></div></div><div><br></div><div>I get the feeling that there's going to be more stuff requiring fixes as you go. Perhaps the best thing its to get in touch with the author directly and find out about the state of the source base before continuing.</div>
<div><br></div><div>Cheers</div><span class="HOEnZb"><font color="#888888"><div>OJ</div><div> </div></font></span><div><div><div class="h5"><br><div class="gmail_quote">On Mon, Dec 24, 2012 at 5:49 PM, Ivan Uemlianin <span dir="ltr"><<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><span style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">Dear Bob</span></div>
<div><span style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px"><br></span></div><div><span style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">This line should be part of the function population_monitor:init/1 (that's file population_monitor, function init, which takes one argument).</span><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">
<br></div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">The error it complains of is {badrecord,state}, so perhaps the record S has been badly set up.</div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">
<br></div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">Are you learning erlang through neuroevolution :) ? Do you have other reference resources?</div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">
<br></div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">Nadolig Llawen</div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px"><br></div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px">
Ivan</div><div style="font-family:'.Helvetica NeueUI';font-size:18px;line-height:24px"><br></div><br>--<br>festina lente<div><br></div></div><div><div><div><br>On 24 Dec 2012, at 07:24, Bob Matthews <<a href="mailto:rgmatthews@orcon.net.nz" target="_blank">rgmatthews@orcon.net.nz</a>> wrote:<br>
<br></div><blockquote type="cite"><div>
<div>Thank you Ivan<br>
<br>
line 82: Population_Id = S#state.population_id,<br>
<br>
Merry Xmas to you too :)<br>
<br>
Bob<br>
Dunedin<br>
New Zealand<br>
<br>
On 24/12/2012 8:14 p.m., Ivan Uemlianin wrote:<br>
</div>
<blockquote type="cite">
<div>I dont have my computer with me but the error is at line 82
of the file population_monitor.erl.</div>
<div><br>
</div>
<div>Best wishes</div>
<div><br>
</div>
<div>Ivan<br>
<br>
--<br>
festina lente
<div><br>
</div>
</div>
<div><br>
On 24 Dec 2012, at 01:32, Bob Matthews <<a href="mailto:rgmatthews@orcon.net.nz" target="_blank">rgmatthews@orcon.net.nz</a>>
wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div>The code that I am looking at is
DXNN2 copyrighted to Gene Sher.<br>
<br>
The error message I got which I am having difficulty
interpreting is as follows....................<br>
<br>
4> population_monitor:start().<br>
{error,{{badrecord,state},<br>
[{population_monitor,init,1,<br>
[{file,"population_monitor.erl"},{line,82}]},<br>
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},<br>
{proc_lib,init_p_do_apply,3,<br>
[{file,"proc_lib.erl"},{line,227}]}]}}<br>
<br>
I am using the latest versionR15B03<br>
<br>
Thank you for you help<br>
<br>
Bob<br>
Dunedin New Zealand<br>
<br>
On 24/12/2012 11:58 a.m., Matti Oinas wrote:<br>
</div>
<blockquote type="cite">
<div>Hi,<br>
<br>
My first proposal is to change the editor to something
more usable like emacs or if you prefer something
different then notepad++, sublime text or eclipse +
erlIDE. Everyone of these are able to show you the line
numbers and offer syntax highlight features.<br>
<br>
It would help a lot if you tell us which code you are
looking at. Server callbacks probably mean gen_server
callbacks so it doesn't matter if you are using windows or
linux.<br>
<br>
Matti<br>
<br>
On 12/24/2012 12:08 AM, Bob Matthews wrote:<br>
</div>
<blockquote type="cite">
Hi<br>
<br>
I have just started to learn Erlang............<br>
I am using Windows 7 on a PC<br>
<br>
<small><small><b><big><big>Question 1</big></big></b></small></small>)
when I get an error message, what is the easiest way for
me to find the exact line number?<br>
I use ms Word as an editor.<br>
<br>
<b>Question 2</b>) the code I am looking at was run on
Unix, on a server. <br>
Part of the code talks about server call-backs etc.<br>
It is unclear how I translate that to a windows PC<br>
<br>
Many thanks<br>
<br>
Bob<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
erlang-questions mailing list
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
<p color="#000000" align="left">No
virus found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
Version: 2013.0.2805 / Virus Database: 2634/5951 - Release
Date: 12/11/12<br>
Internal Virus Database is out of date.</p>
</blockquote>
<br>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>erlang-questions mailing list</span><br>
<span><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></span><br>
<span><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br>
</div>
</blockquote>
<p color="#000000" align="left">No virus
found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
Version: 2013.0.2805 / Virus Database: 2634/5951 - Release Date:
12/11/12<br>
Internal Virus Database is out of date.</p>
</blockquote>
<br>
</div></blockquote></div></div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br><br>OJ Reeves<div><a href="tel:%2B61%20431%20952%20586" value="+61431952586" target="_blank">+61 431 952 586</a><br><a href="http://buffered.io/" target="_blank">http://buffered.io/</a></div>
</div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br>