Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Readme2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ b2. If gsl_rng_default_seed =!= 0: gsl_seed=gsl_rng_default_seed (see 4. below)
4. System environment: GSL_RNG_TYPE and GSL_RNG_SEED
- Without any environment variables, GSL uses the initial defaults, an mt19937 generator with a default seed of gsl_rng_default_seed=0.
- See also: https://www.gnu.org/software/gsl/manual/html_node/Random-number-environment-variables.html

5. Version of GSL

The version of GSL that includes support for sampling from a multivariate normal distibution is:

https://fossies.org/linux/misc/gsl-2.4.tar.gz/
12 changes: 12 additions & 0 deletions header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include "mboard.h"

/* Set ranges for FLAME write-out functions */

/*User-defined ranges*/
/*
#define FLAME_INT_MAX (int)1e+12
#define FLAME_DOUBLE_MAX 1e+12
#define FLAME_INT_MIN (int)-1e+12
#define FLAME_DOUBLE_MIN -1e+12
*/

/* Default C ranges (float.h, limits.h) */
#define FLAME_INT_MAX INT_MAX
#define FLAME_DOUBLE_MAX DBL_MAX
#define FLAME_INT_MIN INT_MIN
#define FLAME_DOUBLE_MIN -DBL_MAX

#define FLAME_TEST_PRINT_START_AND_END_OF_MODEL_FUNCTIONS 0
#define FLAME_TEST_PRINT_START_AND_END_OF_LIBMBOARD_CALLS 0
Expand Down
4 changes: 2 additions & 2 deletions memory.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ void set_$name($type <?if dynamic_array?>* <?end if?><?if static_array?>*<?end i
{
<?foreach xagent?><?if allvar_in_agent?> if(current_xmachine->xmachine_$name)
{
assert($allvar_name < FLAME_DOUBLE_MAX);
assert($allvar_name > FLAME_DOUBLE_MIN);
//assert($allvar_name < FLAME_DOUBLE_MAX);
//assert($allvar_name > FLAME_DOUBLE_MIN);
(*current_xmachine->xmachine_$name).$allvar_name = $allvar_name;
}
<?end if?><?end foreach?>}
Expand Down
29 changes: 29 additions & 0 deletions tests/test_agent_order/models/basic_agent_order/0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<states>
<itno>0</itno>
<environment>
</environment>
<xagent>
<name>Agent</name>
<id>1</id>
</xagent>
<xagent>
<name>Agent</name>
<id>2</id>
</xagent>
<xagent>
<name>Agent</name>
<id>3</id>
</xagent>
<xagent>
<name>Agent</name>
<id>4</id>
</xagent>
<xagent>
<name>Agent</name>
<id>5</id>
</xagent>
<xagent>
<name>Agent</name>
<id>6</id>
</xagent>
</states>
11 changes: 11 additions & 0 deletions tests/test_agent_order/models/basic_agent_order/agent_functions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <stdio.h>
#include "header.h"
#include "Agent_agent_header.h"

int print_id(void)
{
fprintf(stderr, "\nIT %d ID %d prints own ID", iteration_loop, ID);

return 0;
}

35 changes: 35 additions & 0 deletions tests/test_agent_order/models/basic_agent_order/model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<xmodel version="2">
<name>Test Model - Xparser 0.17.1 Message randomization</name>
<version>Version 1.0, 18.01.2018</version>
<description>Author: Sander van der Hoog (svdhoog@gmail.com)</description>
<models/>
<environment>
<functionFiles>
<file>agent_functions.c</file>
</functionFiles>
</environment>
<agents>
<xagent>
<name>Agent</name>
<description></description>
<memory>
<variable>
<type>int</type>
<name>id</name>
<description>Agent ID.</description>
</variable>
</memory>
<functions>
<function>
<name>print_id</name>
<description></description>
<currentState>start_Agent</currentState>
<nextState>end_Agent</nextState>
<inputs/>
<outputs/>
</function>
</functions>
</xagent>
</agents>
<messages/>
</xmodel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Test basic_agent_order:

IT 1 ID 6 prints own ID
IT 1 ID 5 prints own ID
IT 1 ID 4 prints own ID
IT 1 ID 3 prints own ID
IT 1 ID 2 prints own ID
IT 1 ID 1 prints own ID
IT 2 ID 6 prints own ID
IT 2 ID 5 prints own ID
IT 2 ID 4 prints own ID
IT 2 ID 3 prints own ID
IT 2 ID 2 prints own ID
IT 2 ID 1 prints own ID
IT 3 ID 6 prints own ID
IT 3 ID 5 prints own ID
IT 3 ID 4 prints own ID
IT 3 ID 3 prints own ID
IT 3 ID 2 prints own ID
IT 3 ID 1 prints own ID
IT 4 ID 6 prints own ID
IT 4 ID 5 prints own ID
IT 4 ID 4 prints own ID
IT 4 ID 3 prints own ID
IT 4 ID 2 prints own ID
IT 4 ID 1 prints own ID
------------------------
29 changes: 29 additions & 0 deletions tests/test_agent_order/models/message_reading/0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<states>
<itno>0</itno>
<environment>
</environment>
<xagent>
<name>Agent</name>
<id>1</id>
</xagent>
<xagent>
<name>Agent</name>
<id>2</id>
</xagent>
<xagent>
<name>Agent</name>
<id>3</id>
</xagent>
<xagent>
<name>Agent</name>
<id>4</id>
</xagent>
<xagent>
<name>Agent</name>
<id>5</id>
</xagent>
<xagent>
<name>Agent</name>
<id>6</id>
</xagent>
</states>
23 changes: 23 additions & 0 deletions tests/test_agent_order/models/message_reading/agent_functions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>
#include "header.h"
#include "Agent_agent_header.h"

int send(void)
{
fprintf(stderr, "\nIT %d ID %d adds ID message", iteration_loop, ID);
add_info_message(ID);

return 0;
}


int read(void)
{
fprintf(stderr, "\nIT %d ID %d reads ID messages:\t", iteration_loop, ID);
START_INFO_MESSAGE_LOOP
fprintf(stderr, "%d ", info_message->id);
FINISH_INFO_MESSAGE_LOOP

return 0;
}

64 changes: 64 additions & 0 deletions tests/test_agent_order/models/message_reading/model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<xmodel version="2">
<name>Test Model - Xparser 0.17.1 Message randomization</name>
<version>Version 1.0, 18.01.2018</version>
<description>Author: Sander van der Hoog (svdhoog@gmail.com)</description>
<models/>
<environment>
<functionFiles>
<file>agent_functions.c</file>
</functionFiles>
</environment>
<agents>
<xagent>
<name>Agent</name>
<description></description>
<memory>
<variable>
<type>int</type>
<name>id</name>
<description>Agent ID.</description>
</variable>
</memory>
<functions>
<function>
<name>send</name>
<description></description>
<currentState>start_Agent</currentState>
<nextState>read</nextState>
<inputs/>
<outputs>
<output>
<messageName>info</messageName>
</output>
</outputs>
</function>

<function>
<name>read</name>
<description></description>
<currentState>read</currentState>
<nextState>end_Agent</nextState>
<inputs>
<input>
<messageName>info</messageName>
</input>
</inputs>
<outputs/>
</function>
</functions>
</xagent>
</agents>
<messages>
<message>
<name>info</name>
<description></description>
<variables>
<variable>
<type>int</type>
<name>id</name>
<description></description>
</variable>
</variables>
</message>
</messages>
</xmodel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Test message_reading:

IT 1 ID 6 adds ID message
IT 1 ID 5 adds ID message
IT 1 ID 4 adds ID message
IT 1 ID 3 adds ID message
IT 1 ID 2 adds ID message
IT 1 ID 1 adds ID message
IT 1 ID 1 reads ID messages: 6 5 4 3 2 1
IT 1 ID 2 reads ID messages: 6 5 4 3 2 1
IT 1 ID 3 reads ID messages: 6 5 4 3 2 1
IT 1 ID 4 reads ID messages: 6 5 4 3 2 1
IT 1 ID 5 reads ID messages: 6 5 4 3 2 1
IT 1 ID 6 reads ID messages: 6 5 4 3 2 1
IT 2 ID 1 adds ID message
IT 2 ID 2 adds ID message
IT 2 ID 3 adds ID message
IT 2 ID 4 adds ID message
IT 2 ID 5 adds ID message
IT 2 ID 6 adds ID message
IT 2 ID 6 reads ID messages: 1 2 3 4 5 6
IT 2 ID 5 reads ID messages: 1 2 3 4 5 6
IT 2 ID 4 reads ID messages: 1 2 3 4 5 6
IT 2 ID 3 reads ID messages: 1 2 3 4 5 6
IT 2 ID 2 reads ID messages: 1 2 3 4 5 6
IT 2 ID 1 reads ID messages: 1 2 3 4 5 6
IT 3 ID 6 adds ID message
IT 3 ID 5 adds ID message
IT 3 ID 4 adds ID message
IT 3 ID 3 adds ID message
IT 3 ID 2 adds ID message
IT 3 ID 1 adds ID message
IT 3 ID 1 reads ID messages: 6 5 4 3 2 1
IT 3 ID 2 reads ID messages: 6 5 4 3 2 1
IT 3 ID 3 reads ID messages: 6 5 4 3 2 1
IT 3 ID 4 reads ID messages: 6 5 4 3 2 1
IT 3 ID 5 reads ID messages: 6 5 4 3 2 1
IT 3 ID 6 reads ID messages: 6 5 4 3 2 1
IT 4 ID 1 adds ID message
IT 4 ID 2 adds ID message
IT 4 ID 3 adds ID message
IT 4 ID 4 adds ID message
IT 4 ID 5 adds ID message
IT 4 ID 6 adds ID message
IT 4 ID 6 reads ID messages: 1 2 3 4 5 6
IT 4 ID 5 reads ID messages: 1 2 3 4 5 6
IT 4 ID 4 reads ID messages: 1 2 3 4 5 6
IT 4 ID 3 reads ID messages: 1 2 3 4 5 6
IT 4 ID 2 reads ID messages: 1 2 3 4 5 6
IT 4 ID 1 reads ID messages: 1 2 3 4 5 6
------------------------
29 changes: 29 additions & 0 deletions tests/test_agent_order/models/message_reading_print/0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<states>
<itno>0</itno>
<environment>
</environment>
<xagent>
<name>Agent</name>
<id>1</id>
</xagent>
<xagent>
<name>Agent</name>
<id>2</id>
</xagent>
<xagent>
<name>Agent</name>
<id>3</id>
</xagent>
<xagent>
<name>Agent</name>
<id>4</id>
</xagent>
<xagent>
<name>Agent</name>
<id>5</id>
</xagent>
<xagent>
<name>Agent</name>
<id>6</id>
</xagent>
</states>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>
#include "header.h"
#include "Agent_agent_header.h"

int send(void)
{
fprintf(stderr, "\nIT %d ID %d adds ID message", iteration_loop, ID);
add_info_message(ID);

return 0;
}



int print_id(void)
{
fprintf(stderr, "\nIT %d ID %d prints own ID", iteration_loop, ID);

return 0;
}

int read(void)
{
fprintf(stderr, "\nIT %d ID %d reads ID messages:\t", iteration_loop, ID);
START_INFO_MESSAGE_LOOP
fprintf(stderr, "%d ", info_message->id);
FINISH_INFO_MESSAGE_LOOP

return 0;
}

Loading