tag:blogger.com,1999:blog-9558689784571293262024-03-13T12:33:36.034+02:00Pawel Biernacki blogArtificial Intelligence. Perkun. Svarog.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.comBlogger166125tag:blogger.com,1999:blog-955868978457129326.post-46096123207375779102022-01-15T23:00:00.004+02:002022-01-15T23:00:58.084+02:00New www.perkun.org<p>I have made a new version of the <a href="https://www.perkun.org">www.perkun.org</a>. It is static now, generated by Doxygen. Currently I am working on "triglav", this is the project with the work name "borsuk". It should be able to support very many hidden variables and input variables. I will use the ideas I got when doing "svarog".<br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-5088902535049381492021-11-23T22:34:00.010+02:002021-11-23T22:41:05.406+02:00Projection states<p>I would like to explain why it is problematic in Svarog to keep "real" states. Let's assume we have four boolean hidden variables. I will use the new, Borsuk syntax: </p><p><b>type boolean={false, true}; </b></p><p><b>type place={Krakow, Warszawa, Wroclaw, Poznan}; </b></p><p><b>hidden variable it_is_raining_in_(X:place):boolean; </b></p><p>This results in four hidden variables:
<b> </b></p><p><b>it_is_raining_in_Krakow:{false, true} </b></p><p><b>it_is_raining_in_Warszawa:{false, true} </b></p><p><b>it_is_raining_in_Wroclaw:{false, true} </b></p><p><b>it_is_raining_in_Poznan:{false, true} </b></p><p>In Svarog we would have 2^4=16 states:
<b> </b></p><p><b>state1={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>false};
state2={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>true};
state3={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>false};
state4={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>true};
state5={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>false};
state6={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>true};
state7={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>false};
state8={it_is_raining_in_Krakow=>false,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>true};
state9={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>false};
state10={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>true};
state11={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>false};
state12={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>false,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>true};
state13={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>false};
state14={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>false,it_is_raining_in_Poznan=>true};
state15={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>false};
state16={it_is_raining_in_Krakow=>true,it_is_raining_in_Warszawa=>true,it_is_raining_in_Wroclaw=>true,it_is_raining_in_Poznan=>true};
</b> </p><p>When we assume they are independent and use the projection states then we have only eight of them:
<b> </b></p><p><b>projection_state1={it_is_raining_in_Krakow=>false} <br /></b></p><p><b>projection_state2={it_is_raining_in_Krakow=>true} </b></p><p><b>projection_state3={it_is_raining_in_Warszawa=>false} <br /></b></p><p><b>projection_state4={it_is_raining_in_Warszawa=>true} </b></p><p><b>projection_state5={it_is_raining_in_Wroclaw=>false} <br /></b></p><p><b>projection_state6={it_is_raining_in_Wroclaw=>true} </b></p><p><b>projection_state7={it_is_raining_in_Poznan=>false} <br /></b></p><p><b>projection_state8={it_is_raining_in_Poznan=>true}
</b> </p><p>This difference increases when we have many hidden variables. For boolean ones there is 2^n real states and 2*n projection states. In Borsuk we will be able to maintain hundreds of thousands of hidden variables, which is clearly impossible in Svarog. </p><p>In Borsuk a belief will be a vector of projections, with each projection containing a map. </p><p><b>projection1 = {projection_state1=>x, projection_state2=>y}</b></p><p>with x+y = 1.0</p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-38112185455665896592021-11-17T12:01:00.000+02:002021-11-17T12:01:18.764+02:00Borsuk - a new project.<p>I have started a new project called Borsuk (this name may still change, the project is not published yet). The idea is to handle many more variables than it was possible in svarog, in particular hidden variables. I will simply assume they are independent. For each boolean hidden variable a belief will contain "projections" with two states, one for false and one for true. They will not be the states in the same sense as in svarog - but rather a kind of projection states. I have also created a syntax to generate many variables and stronger rules. The below code is an example: </p><p><b>
type person = {me, Gotrek, Gwaigilion, Gerrudir}; </b></p><p><b>type information = {where_is_(X:person)};
</b> </p><p> </p><p>It means we have four persons, me (meaning the player), Gotrek, Gwaigilion and Gerrudir. For each of them a new information value will be created, i.e.
<b> </b></p><p><b>where_is_me </b></p><p><b>where_is_Gotrek </b></p><p><b>where_is_Gwaigilion </b></p><p><b>where_is_Gerrudir
</b> </p><p> </p><p>In the type definition it will be possible to use the type itself, for instance:
<b> </b></p><p><b>type place = {Krakow, Warszawa, Wroclaw, Poznan, Gdansk}; </b></p><p><b> </b></p><p><b>type action = {goto_(X:place),ask_(X:person)_to_(Y:action),</b></p><p><b>ask_(X:person)_where_is_(Y:person),tell_(X:person)_(Y:information)}; </b></p><p>There will be a special operation called "expanding" with a certain parameter called "depth", so that for Gotrek and Krakow it will create for example action:
<b>
ask_Gotrek_to_goto_Krakow
</b> </p><p>Because goto_Krakow is a regular action. <br /></p><p>The variables will be created with the same pattern. </p><p>For example: </p><p><b>
hidden variable (X:person)_can_see_(Y:person):boolean; </b></p><p><b>hidden variable (X:person)_has_told_(Y:person)_(Z:information):boolean; </b></p><p><b>hidden variable (X:information):boolean; </b></p><p>This allows thousands of hidden variables to be generated, depending on the expanding depth. I will use a similar syntax for rules which will replace the world model known from svarog.
</p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-72910738359246943842021-06-01T12:38:00.001+03:002021-06-01T16:26:49.683+03:00I think he thinks I think ...<p>I have realized what is needed to make a successful planning/optimizing algorithm for multiple intelligent agents. We need a special belief that not only covers our agent's hidden variables but also what he thinks the others think. And what he thinks the others think he thinks. And so on. Up to a certain level. Agents in a simple world would perceive each other as agents and would try to model each others psychology.<br /></p><p>My first attempt to construct a language that does that failed - it was Perkun2. I thought about making something like Svarog for multiple agents problem. But I have no idea how it should work.<br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-88444643470791472492021-05-25T18:01:00.004+03:002021-05-25T18:01:46.959+03:00svarog-0.0.8 and dorban-0.0.2<p>There is a new Svarog and a new Dorban out there. In Svarog I found the way to handle the situations when there were too many possible states to discretize the space of beliefs. It is much faster now. The new Dorban uses it and is, consequently, much faster.</p><p><a href="https://sourceforge.net/projects/dorban/">https://sourceforge.net/projects/dorban/</a></p><p><a href="https://github.com/pawelbiernacki/svarog">https://github.com/pawelbiernacki/svarog</a></p><p>The current intelligence level is 4, in spite of that the response time on my computer is below 1s.</p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-27675507428213629592021-05-06T12:12:00.001+03:002021-05-06T13:28:06.590+03:00svarog-0.0.6 - Perl scripts to parallelize the precalculations.<p>If you have a multiple core machine you would like to parallelize the precalculations. The new svarog (0.0.6) contains four Perl scripts that help to do it. While you are free to write your own scripts using the svarog-merge tool (created in 0.0.5) it is more convenient to use these scripts:</p><ul style="text-align: left;"><li>svarog_generate_precalculate_tasks.pl</li><li>svarog_generate_precalculate_shell.pl</li><li>svarog_generate_control_shell.pl</li><li>svarog_generate_merge_shell.pl</li></ul><p>In order to use them do the following steps:</p><ol style="text-align: left;"><li>create a new directory and enter it</li><li>copy a valid Svarog specification (without any commands) into it, for example as specification.svarog </li><li>copy specification.svarog into create_visible_states.svarog and append "cout << visible states << eol;" to it.</li><li>execute: svarog create_visible_states.svarog > visible_states.txt</li><li>check the amount of lines in visible_states.txt, in dorban's case it was 360</li><li>execute: svarog_generate_precalculate_tasks.pl 4 2 specification.svarog visible_states.txt <br /></li><li>execute: svarog_generate_precalculate_shell.pl 360 > precalculate.sh</li><li>execute: bash precalculate.sh</li></ol><p>This will start the precalculations on all your processors, in parallel. In order to check whether they terminated you can use a control shell:</p><ol style="text-align: left;"><li>execute: svarog_generate_control_shell.pl 360 > control.sh</li><li>execute: bash control.sh </li></ol><p>If there are any errors this probably means that some precalculations did not terminate yet. You can use the ps shell command to check whether any svarogs are still running. When the control.sh reports no errors you will want to merge the Svarog specifications created by your tasks in the directory KNOWLEDGE:</p><ol style="text-align: left;"><li>execute: svarog_generate_merge_shell.pl 360 > merge.sh</li><li>execute: bash merge.sh</li></ol><p>The result Svarog specification containing the precalculated knowledge will be the file result.svarog.</p><p>You should of course replace 360 in the above examples with the actual amount of visible states in your case.</p><p>Replace 4 (the first argument for svarog_generate_precalculate_tasks.pl) with the depth you want for the precalculations. It will affect the time required for the precalculations, but not the result size.</p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-428476448073808482021-05-05T08:46:00.002+03:002021-05-05T08:52:01.112+03:00svarog-merge and a new precalculate command<p>svarog 0.0.5 has been released. It contains two enhancements:</p><ul style="text-align: left;"><li>a svarog-merge tool</li><li>enhanced command cout << precalculate() << eol</li></ul><p> </p><p>The enhanced command cout << precalculate() << eol allows precalculating knowledge for a specific visible state. The syntax is: <br /></p><p><span style="color: white;"><span style="background-color: black;">cout << precalculate(<depth>,<granularity>,<query>) << eol;</span></span></p><p>For example:</p><p><span style="background-color: black;"><span style="color: white;">cout << precalculate(3,2,{has_dorban_won_a_fight=>none ,where_is_dorban=>place_Poznan ,can_dorban_see_pregor=>true ,can_dorban_see_pregor_is_alive=>true ,can_dorban_see_vampire=>true ,is_pregor_following_dorban=>true }) << eol;<br /></span></span><br />The result is a valid Svarog specification with the knowledge precalculated merely for this visible state.</p><p>The tool svarog-merge requires two files:</p><p><span style="background-color: black;"><span style="color: white;">svarog-merge <file1> <file2></span></span></p><p>It adds all missing precalculated visible states from file2 to the file1 specification. The precalculated knowledge section must exist in the file1 (even if the section is empty) and the precalculated knowledge in both files must have the same depth and granularity.</p><p>Using the new "precalculate" command along with the svarog-merge tool allows running the precalculations on multiple core machines effectively (so that all processors have work to do).</p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-60594914704359288492021-04-30T15:12:00.002+03:002021-04-30T15:38:14.168+03:00svarog-0.0.4 has been released!<p>A new version of svarog (0.0.4) has been released! It is available at:</p><p><a href="https://github.com/pawelbiernacki/svarog">https://github.com/pawelbiernacki/svarog</a></p><p>It contains two new commands:</p><p><span style="background-color: black;"><span style="color: white;">cout << estimate(<depth>,<granularity>) << eol;</span></span></p><p>and</p><p><span style="color: white;"><span style="background-color: black;">cout << precalculate(<dept>,<granularity>) << eol;</span></span></p><p>Both <depth> and <granularity> are integer parameters, <depth> is the depth of the game tree and should be a small integer, <granularity> is the amount of values in one dimension when discretizing the hypercube of beliefs, should also be a small integer, preferably 2.</p><p>The file examples/example6_precalculated.svarog has been generated automatically by svarog for the depth 1 and granularity 2. It is not very intelligent (since depth 1 is not much) but svarog is able to use the precalculated knowledge already.</p><p>The command "estimate" does not produce a valid Svarog specification - it skips the planning (determining the actions). It can be used to estimate the amount of "on belief" clauses by the "precalculate" command.</p><p>WARNING: When using svarog-daemons - they do not benefit of the precalculated knowledge yet.<br /></p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-63099637886179756232021-04-28T11:59:00.002+03:002021-04-28T11:59:54.322+03:00Hyperball, not a hypercube<p>Due to the normalization the space of possible beliefs is an n dimensional hyperball with a radius 1.0, not a hypercube. In spite of that Svarog generates first a hypercube, for example for three states and granularity 2 there would be:</p><p>(0,0,1)</p><p>(0,1,0)</p><p>(0,1,1)</p><p>(1,0,0)</p><p>(1,0,1)</p><p>(1,1,0)</p><p>(1,1,1)</p><p>Then it applies the normalization (when doing precalculations):</p><p>(0,0,1.0)</p><p>(0,1.0,0)</p><p>(0,0.5,0.5)</p><p>(1.0,0,0)</p><p>(0.5,0,0.5)</p><p>(0.5,0.5,0)</p><p>(0.33,0.33,0.33)</p><p>The tuple (0,0,0) is not taken into account since it cannot be normalized and does not make sense.<br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-962591398709666422021-04-27T18:40:00.005+03:002021-04-28T11:53:32.579+03:00Precalculations in svarog-0.0.4<p> There will be a new command in svarog-0.0.4 (that has not been published yet). The command syntax is:</p><p><span style="color: white;"><span style="background-color: black;">cout << precalculate(<depth>,<granularity>) << eol;</span></span></p><p>Example:</p><p><span style="background-color: black;"><span style="color: white;">cout << precalculate(4,2) << eol;</span></span></p><p>This command generates (and prints to the standard output) a Svarog specification with a precalculated knowledge about the optimal actions for the given depth of planning and granularity.</p><p>The depth is the same parameter as the one passed to the loop command - it is the depth (or height) of the game tree. It should be a small integer.<br /></p><p>The granularity should be a small integer value, preferably 2. Svarog will discretize the space of beliefs, which is a hypercube of n dimensions, with n being the amount of possible states for a given visible state. Then when planning it will be able to use the precalculated knowledge so that it searches for the closest node in the hypercube to the actual belief.<br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-bTPZ3vn7Hag/YIguG7UPo1I/AAAAAAAAAs8/I4jAbJ0FdVMJZyHC03XeziQLYCsgwXoVwCLcBGAsYHQ/s1056/hypercube.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1056" data-original-width="816" height="320" src="https://1.bp.blogspot.com/-bTPZ3vn7Hag/YIguG7UPo1I/AAAAAAAAAs8/I4jAbJ0FdVMJZyHC03XeziQLYCsgwXoVwCLcBGAsYHQ/s320/hypercube.png" /> </a></div><div class="separator" style="clear: both; text-align: center;"> <br /></div><p>WARNING: For a reasonable specification running this command can take a couple days.</p><p>It should significantly improve the performance when planning. </p><p>In some cases the amount of possible states is still too large to build this discrete hypercube, even for a small granularity (2). For example when the amount of possible states equals 32 then the amount of nodes in the discrete hypercube is 4.29497e+09. In this case (whenever the amount is greater than 1024) Svarog will denote the visible state as "too complex". When encountered these visible states the planning should be done normally, although for the "future beliefs" we still may benefit of the precalculated cache knowledge.</p><p>The idea is that the computer analyses the given Svarog specification and performs planning for hypothetical visible states and some beliefs. Then it will have a list of "rules" of the form:</p><p><visible state> x <belief> -> <optimal action></p><p>It will clearly not cover all possible beliefs, but we will be able to find the closest rule to the actual belief in terms of the cartesian distance.<br /></p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-88566402967884287992021-04-15T17:04:00.001+03:002021-04-15T17:04:23.237+03:00dorban-0.0.0 - demo for Svarog<p>I have written a small demo program for Svarog. It is called dorban, it can be downloaded from <a href="https://sourceforge.net/projects/dorban/">https://sourceforge.net/projects/dorban/</a> .</p><p>I will describe it on my website <a href="https://www.perkun.org">https://www.perkun.org</a> .</p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-GUcwXN0Fhew/YHhHyyiuefI/AAAAAAAAAr4/8hAs0ZasDi8AP-K9eFNhtEt2qm2tLGzJgCLcBGAsYHQ/s1030/Screenshot%2Bfrom%2B2021-04-15%2B08-52-57.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1030" src="https://1.bp.blogspot.com/-GUcwXN0Fhew/YHhHyyiuefI/AAAAAAAAAr4/8hAs0ZasDi8AP-K9eFNhtEt2qm2tLGzJgCLcBGAsYHQ/s320/Screenshot%2Bfrom%2B2021-04-15%2B08-52-57.png" width="320" /></a></div><br /><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-54029932210249575592020-10-20T21:43:00.001+03:002020-10-20T22:00:52.116+03:00Svarog test5<p>I have added to the github repository for Svarog a new test, test5. It is activated by running "make test5" in the examples folder. It is based on the Svarog specification examples/example3_dorban.svarog .</p><p>When you run the test5 it is good to have an assistance of multiple svarog daemons. The client should have a configuration file /home/$USER/.svarog/svarog.ini in place.</p><p>The specification contains three hidden variables and five localizations. The localizations are connected as follows:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-9hJG_doBcvI/X48tU8JqPLI/AAAAAAAAAkg/LTa_zOjz8kIYss8Gz-B1mW33BNnvXpv2gCLcBGAsYHQ/s1030/screenshot1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1030" src="https://1.bp.blogspot.com/-9hJG_doBcvI/X48tU8JqPLI/AAAAAAAAAkg/LTa_zOjz8kIYss8Gz-B1mW33BNnvXpv2gCLcBGAsYHQ/s320/screenshot1.png" width="320" /></a></div><p>The input variables are:</p><ul style="text-align: left;"><li>has_dorban_won_a_fight (normally none, after attacking a vampire true or false)</li><li>where_is_dorban - one of the places</li><li>can_dorban_see_pregor - true or false</li><li>can_dorban_see_pregor_is_alive - normally none, if dorban can see pregor either true or false</li><li>can_dorban_see_vampire - true or false</li><li>is_pregor_following_dorban - true or false <br /></li></ul><p>In test5 Dorban immediately meets Pregor in Krakow (alive), asks him to join him, then they go together to Warszawa, do not find vampire here, then they go to Poznan and meet the vampire. The first attack is succesfull, but the second one fails and Pregor (still alive) is not accompanying Dorban any more. Then Dorban asks Pregor to accompany him, Pregor accepts, they both attack the vampire and the attack fails. Pregor dies. When Dorban sees that Pregor is dead he knows he would not ever become living any more, and Dorban decides to attack the vampire on his own.</p><p>The svarog with all the examples can be downloaded from <a href="https://github.com/pawelbiernacki/svarog">https://github.com/pawelbiernacki/svarog.</a><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-75918335495500579232020-10-07T00:11:00.001+03:002020-10-07T00:11:04.875+03:00svarog is on github!<p>Svarog is available on github! <a href="https://github.com/pawelbiernacki/svarog">https://github.com/pawelbiernacki/svarog</a></p><p><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-7400358294665368392020-10-04T18:55:00.001+03:002020-10-04T18:56:45.107+03:00svarog-0.0.3 has been released!<p> svarog-0.0.3 has been released! It contains apart from the interpreter (svarog) also a daemon (svarog-daemon) and a helper program: svarog-dummy-client. Now when working in an interactive mode (command loop) svarog will try to use the svarog-daemons (if configured so). Svarog is a bit slower than Perkun because it does not create a memory cache for the model, but it is much more powerful due to the support of the svarog-daemons.</p><p>Download svarog-0.0.3 from <a href="https://www.perkun.org/Download">https://www.perkun.org/Download</a><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-14423124668226729092020-09-28T23:43:00.001+03:002020-09-28T23:45:11.545+03:00svarog 0.0.2 has been released<p> A new version of svarog (0.0.2) has been released. It has some minor improvements. Currently the negative numeric literals are allowed (unary minus is supported). This can be useful when defining payoff.</p><p><br /></p><p>Svarog 0.0.2 is available for download from my page <a href="https://www.perkun.org">https://www.perkun.org</a><br /></p>Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-46288334943908010312020-05-12T07:30:00.002+03:002020-05-12T07:30:36.541+03:00Perkun2 is wrong!I have an impression that Perkun2 is wrong! The problem is the belief of the agents that are not the first (main) agent. I am not sure how to fix this.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-11706609260078241222020-04-13T04:18:00.001+03:002020-04-13T04:18:10.115+03:00svarog_0_0_1.pdfI have added a description of the svarog algorithm and language. It is available at <a href="https://www.perkun.org/resources/pdf/svarog_0_0_1.pdf">https://www.perkun.org/resources/pdf/svarog_0_0_1.pdf</a>.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-29244844108114814832020-01-27T12:42:00.000+02:002020-01-27T12:42:13.240+02:00kuna -> svarogI have changed the name of the project "kuna" to "svarog". svarog-0.0.1 is now available for download on the <a href="http://www.perkun.org/">www.perkun.org</a>. Still not described, but I work on it.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-47087216619031078672019-12-25T15:01:00.001+02:002019-12-25T15:01:19.378+02:00kuna-0.0.0 has been published!The language kuna-0.0.0 has been published! It can be downloaded from <a href="https://www.perkun.org/Download">https://www.perkun.org/Download</a>. Take a look at the examples folder, it contains some working examples. I will spend some time on documenting it.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-24032840571069360982019-12-19T20:58:00.000+02:002019-12-19T20:58:28.154+02:00kuna - a new languageI have a new language. Its name is "kuna". It is not published yet. It resembles perkun, but does not keep all its model in memory. Instead it calculates the model value from certain rules whenever it is necessary. It is therefore a little stronger than perkun. It allows more input and hidden variables.<br />
<br />
In order to create kuna I used some of the perkun code. Especially the parser and the optimization algorithm are taken almost directly from perkun. The syntax is similar. Kuna comes as a library, just like perkun, so it is possible to use it in your own C++ programs.<br />
<br />
A kuna program consists of three sections - values, variables and knowledge (describing both the payoff and model).<br />
Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-34141501565808314972019-12-03T19:19:00.004+02:002019-12-03T19:19:53.427+02:00www.perkun.orgI have created a website dedicated for perkun, wlodkowic, zubr and perkun2. It is <a href="http://www.perkun.org/">www.perkun.org</a>.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-51015732532126673372019-02-02T15:21:00.001+02:002019-02-02T16:00:38.826+02:00A simple Perkun exampleThe below Perkun code represents a very simple example. There are two state variables - a (input variable) and b (hidden variable). There is also an output variable c. All the variables have boolean values.<br />
<br />
The output variable values combinations are actions. In this example there are two actions: c=>false and c=>true. For each action we can represent the model as a directed graph, for example:<br />
<br />
c=>false:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-zwmrcp2phzc/XFWV-9z21RI/AAAAAAAAAbE/U--QIILAMxw7ZadiN006RKLrwssf2IvYwCLcBGAs/s1600/y.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="299" data-original-width="598" height="160" src="https://3.bp.blogspot.com/-zwmrcp2phzc/XFWV-9z21RI/AAAAAAAAAbE/U--QIILAMxw7ZadiN006RKLrwssf2IvYwCLcBGAs/s320/y.png" width="320" /></a></div>
Every edge has the label 1.0, which corresponds with the transition probability.<br />
<br />
And c=>true:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-bxs_0eDVbxM/XFWWSb2NeWI/AAAAAAAAAbM/SNMRqRCflk0PnItB9eFFMlKstwdKB6lFACLcBGAs/s1600/x.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="530" data-original-width="747" height="227" src="https://2.bp.blogspot.com/-bxs_0eDVbxM/XFWWSb2NeWI/AAAAAAAAAbM/SNMRqRCflk0PnItB9eFFMlKstwdKB6lFACLcBGAs/s320/x.png" width="320" /></a></div>
We can see that in each of the graphs the states are containing the state variables, i.e. a and b. The last graph can be formed into:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-UAnsBBSvLt8/XFWh6So_AMI/AAAAAAAAAbY/44J2-xNI1ic6EaxFQHLZFoRAjyWnGCkRwCLcBGAs/s1600/x2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="609" data-original-width="371" height="320" src="https://1.bp.blogspot.com/-UAnsBBSvLt8/XFWh6So_AMI/AAAAAAAAAbY/44J2-xNI1ic6EaxFQHLZFoRAjyWnGCkRwCLcBGAs/s320/x2.png" width="194" /></a></div>
The two subgraphs labeled "a=>false" and "a=>true" are called in Perkun the "visible states". Each of them contains two states with fixed input variable values differing only by the hidden variable values.<br />
<br />
And here is the Perkun code:<br />
<span style="background-color: black;"><span style="color: white;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span></span>
<span style="background-color: black;"><span style="color: white;"><span style="font-family: "courier new" , "courier" , monospace;">#!perkun<br /><br />values <br />{<br /> value false, true;<br />}<br /><br />variables<br />{<br /> input variable a:{false, true};<br /> hidden variable b:{false, true};<br /> output variable c:{false, true};<br />}<br /><br />payoff<br />{<br />set({a=>false}, 0.0);<br />set({a=>true}, 100.0);<br />}<br /><br />model<br />{<br /># model<br /># {c=>false}<br />set({a=>false ,b=>false },{c=>false },{a=>false ,b=>false },1.00000);<br />set({a=>false ,b=>false },{c=>false },{a=>false ,b=>true },0.00000);<br />set({a=>false ,b=>false },{c=>false },{a=>true ,b=>false },0.00000);<br />set({a=>false ,b=>false },{c=>false },{a=>true ,b=>true },0.00000);<br /><br /># {c=>true}<br />set({a=>false ,b=>false },{c=>true },{a=>false ,b=>false },0.00000);<br />set({a=>false ,b=>false },{c=>true },{a=>false ,b=>true },1.00000);<br />set({a=>false ,b=>false },{c=>true },{a=>true ,b=>false },0.00000);<br />set({a=>false ,b=>false },{c=>true },{a=>true ,b=>true },0.00000);<br /><br /># {c=>false}<br />set({a=>false ,b=>true },{c=>false },{a=>false ,b=>false },0.00000);<br />set({a=>false ,b=>true },{c=>false },{a=>false ,b=>true },1.00000);<br />set({a=>false ,b=>true },{c=>false },{a=>true ,b=>false },0.00000);<br />set({a=>false ,b=>true },{c=>false },{a=>true ,b=>true },0.00000);<br /><br /># {c=>true}<br />set({a=>false ,b=>true },{c=>true },{a=>false ,b=>false },0.00000);<br />set({a=>false ,b=>true },{c=>true },{a=>false ,b=>true },0.00000);<br />set({a=>false ,b=>true },{c=>true },{a=>true ,b=>false },1.00000);<br />set({a=>false ,b=>true },{c=>true },{a=>true ,b=>true },0.00000);<br /><br /># {c=>false}<br />set({a=>true ,b=>false },{c=>false },{a=>false ,b=>false },0.00000);<br />set({a=>true ,b=>false },{c=>false },{a=>false ,b=>true },0.00000);<br />set({a=>true ,b=>false },{c=>false },{a=>true ,b=>false },1.00000);<br />set({a=>true ,b=>false },{c=>false },{a=>true ,b=>true },0.00000);<br /><br /># {c=>true}<br />set({a=>true ,b=>false },{c=>true },{a=>false ,b=>false },0.00000);<br />set({a=>true ,b=>false },{c=>true },{a=>false ,b=>true },0.00000);<br />set({a=>true ,b=>false },{c=>true },{a=>true ,b=>false },0.00000);<br />set({a=>true ,b=>false },{c=>true },{a=>true ,b=>true },1.00000);<br /><br /># {c=>false}<br />set({a=>true ,b=>true },{c=>false },{a=>false ,b=>false },0.00000);<br />set({a=>true ,b=>true },{c=>false },{a=>false ,b=>true },0.00000);<br />set({a=>true ,b=>true },{c=>false },{a=>true ,b=>false },0.00000);<br />set({a=>true ,b=>true },{c=>false },{a=>true ,b=>true },1.00000);<br /><br /># {c=>true}<br />set({a=>true ,b=>true },{c=>true },{a=>false ,b=>false },1.00000);<br />set({a=>true ,b=>true },{c=>true },{a=>false ,b=>true },0.00000);<br />set({a=>true ,b=>true },{c=>true },{a=>true ,b=>false },0.00000);<br />set({a=>true ,b=>true },{c=>true },{a=>true ,b=>true },0.00000);<br /><br />}<br /><br />loop(1);</span></span></span><br />
When we execute the code with perkun we enter the interactive mode:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: black;"><span style="color: white;">loop with depth 1<br />I expect the values of the variables: a <br />perkun></span></span></span><br />
<br />
Let's type "false":<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: black;"><span style="color: white;">belief:<br />b=false a=false 0.500000<br />b=true a=false 0.500000<br />optimal action:<br />c=true <br />perkun> </span></span></span><br />
We can see that Perkun is not sure whether we are in the state "a=>false,b=>false" or "a=>false,b=>true" - they both have 50% belief probability. Let's type "false" again:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: black;"><span style="color: white;">belief:<br />b=false a=false 0.00000<br />b=true a=false 1.00000<br />optimal action:<br />c=true <br />perkun> </span></span></span><br />
<br />
Now it knows we are in the state "a=>false,b=>true" and wants as to "move" i.e. to execute the action "c=>true". Let us type "true":<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: black;"><span style="color: white;">belief:<br />b=false a=true 1.00000<br />b=true a=true 0.00000<br />optimal action:<br />c=false <br />perkun></span></span></span><br />
Now finally it has got what it likes - "a=>true" (see the payoff). Therefore it asks us to stay in the state (perform the action c=>false).<br />
<br />
<br />
<br />Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-23491818412677340202018-12-19T13:26:00.000+02:002018-12-19T13:30:15.424+02:00Perkun Wars optimal strategyIn the Perkun Wars there are three NPCs: Dorban, Pregor and Thragos. Dorban is a witcher, he is continuously hunting the vampire. Pregor and Thragos are humans - they are avoiding the vampire. You can attack the vampire whenever you see him, but it is the best idea to attack him when the NPCs are around.<br />
<br />
There are two strategies: either you will hunt the vampire just like Dorban does (and thus you will mainly cooperate with Dorban) or you will wait with the humans till the vampire comes himself. The latter strategy is better - because the help of Pregor and Thragos is better than the help of Dorban. Very rarely you will be lucky enough to meet the vampire with all the three NPCs. This is your opportunity - attack him!<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-UMKd7rL5K3U/XBoqo1ZRjLI/AAAAAAAAAaQ/Lc4tPBX3xAc8bq7gT_N_XwAm53_JlhdBwCLcBGAs/s1600/novigrad.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="128" data-original-width="128" src="https://4.bp.blogspot.com/-UMKd7rL5K3U/XBoqo1ZRjLI/AAAAAAAAAaQ/Lc4tPBX3xAc8bq7gT_N_XwAm53_JlhdBwCLcBGAs/s1600/novigrad.png" /></a></div>
<br />Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-609088458861919402018-12-18T10:30:00.000+02:002018-12-18T10:30:00.332+02:00Perkun WarsI have added a website for my game - Perkun Wars:<br />
<br />
<a href="http://www.pawelbiernacki.net/software/perkun_wars/index_pl.jsp">http://www.pawelbiernacki.net/software/perkun_wars/index_pl.jsp</a><br />
<br />
This game is intended mainly for the developers willing to use Perkun AI library in their own projects.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0tag:blogger.com,1999:blog-955868978457129326.post-58536954757605607052018-12-12T14:47:00.000+02:002018-12-12T14:47:03.097+02:00BorsukI have published my new project - Borsuk. Not finished yet. You can download it from <a href="http://www.pawelbiernacki.net/borsuk-0.0.0.tar.gz">www.pawelbiernacki.net/borsuk-0.0.0.tar.gz</a><br />
<br />
It requires SWI Prolog (devel packages), flex and bison. Just like Perkun it is also a library - libborsuk.<br />
<br />
Take a look at examples/example2_fantasy.borsuk. It begins with declarations of classes and objects belonging to them, for example dorban is a person.<br />
<br />
<span style="background-color: black;"><span style="color: white;">object dorban:person;</span></span><br />
<br />
Then the variables (including hidden variables) can be generated with the templates like this one:<br />
<br />
<span style="background-color: black;"><span style="color: white;">hidden variable has_(A:person)_(X:activity)_(B:person):boolean;</span></span><br />
<br />
For each tuple (A,X,B) such that A is a person, X is an activity and B is a person it will generate the corresponding hidden variable. For example:<br />
<span style="background-color: black;"><span style="color: white;"><br /></span></span>
<span style="background-color: black;"><span style="color: white;">hidden variable has_dorban_attacked_pregor:{none,false,true};</span></span><br />
<br />
As stated before borsuk will assume that the hidden variables are independent (or at least most of them are independent). This should allow Borsuk to support thousands of hidden variables, which was impossible for Perkun.Pawel Biernackihttp://www.blogger.com/profile/00238950729282149287noreply@blogger.com0