25 character (len=*),
parameter,
private ::
modname =
"(THE_NEUROBIO)"
77 type(
food_item),
allocatable,
dimension(:) :: foods_seen
79 real(
srp),
allocatable,
dimension(:) :: foods_distances
83 integer :: food_seen_count
147 real(
srp) :: consp_body_size
149 real(
srp) :: consp_body_mass
153 real(
srp) :: consp_distance
155 logical :: sex_is_male
190 integer :: conspecifics_seen_count
221 real(
srp) :: sobj_distance
241 procedure,
public :: visibility => &
252 real(
srp),
allocatable,
dimension(:) :: predators_attack_rates
254 integer :: predators_seen_count
278 generic,
public :: set_attack_rate => set_attack_rate_v, set_attack_rate_s
375 real(
srp) :: reproduct_fact
449 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_light
451 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_depth
453 integer ,
dimension(HISTORY_SIZE_PERCEPTION) :: memory_food
455 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_foodsiz
457 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_foodist
459 integer ,
dimension(HISTORY_SIZE_PERCEPTION) :: memory_consp
461 integer ,
dimension(HISTORY_SIZE_PERCEPTION) :: memory_pred
463 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_stom
465 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_bdmass
467 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_energ
469 real(
srp),
dimension(HISTORY_SIZE_PERCEPTION) :: memory_reprfac
490 procedure,
public :: get_food_mean_n_split => &
501 procedure,
public :: get_food_mean_size_split => &
506 procedure,
public :: get_food_mean_dist => &
513 procedure,
public :: get_food_mean_dist_split => &
531 procedure,
public :: get_pred_mean_split => &
659 procedure,
public :: food_items_below_all => &
667 procedure,
public :: food_items_below_horiz => &
673 generic,
public :: food_items_below => &
674 food_items_below_all, food_items_below_horiz
678 procedure,
public :: food_mass_below_all => &
686 procedure,
public :: food_mass_below_horiz => &
692 generic,
public :: food_mass_below => &
693 food_mass_below_all, food_mass_below_horiz
697 procedure,
public :: food_items_above_all => &
705 procedure,
public :: food_items_above_horiz => &
711 generic,
public :: food_items_above => &
712 food_items_above_all, food_items_above_horiz
716 procedure,
public :: food_mass_above_all => &
724 procedure,
public :: food_mass_above_horiz => &
730 generic,
public :: food_mass_above => &
731 food_mass_above_all, food_mass_above_horiz
735 procedure,
public :: food_dist_below => &
740 procedure,
public :: food_dist_above => &
747 procedure,
public :: consp_below_all => &
752 procedure,
public :: consp_above_all => &
758 procedure,
public :: consp_below_horiz => &
764 procedure,
public :: consp_above_horiz => &
770 generic,
public :: consp_below => consp_below_all, consp_below_horiz
775 generic,
public :: consp_above => consp_above_all, consp_above_horiz
779 procedure,
public :: consp_dist_below => &
784 procedure,
public :: consp_dist_above => &
800 procedure,
public :: pred_below_horiz => &
806 procedure,
public :: pred_above_horiz => &
812 generic,
public :: pred_below => pred_below_all, pred_below_horiz
817 generic,
public :: pred_above => pred_above_all, pred_above_horiz
821 procedure,
public :: pred_dist_below => &
826 procedure,
public :: pred_dist_above => &
839 procedure,
public :: risk_pred_s => &
849 procedure,
public :: risk_pred_p => &
854 procedure,
public :: risk_pred_w => &
861 generic,
public :: risk_pred => risk_pred_s, risk_pred_p, risk_pred_w
866 procedure,
public :: food_probability_capture_subjective => &
922 procedure,
public :: motivation_components => &
932 procedure,
public :: motivation_components_init => &
939 procedure,
public :: attention_init => &
968 character(len=LABEL_LENGTH),
private :: label
975 real(
srp) :: motivation_prim
977 real(
srp) :: motivation_finl
980 logical :: dominant_state
1029 procedure,
public :: motivation_value_prim => &
1043 procedure,
public :: attention_copy => &
1050 procedure,
public :: motivation_calculate => &
1112 integer,
private :: number_of_states
1132 procedure,
public :: is_max_final_val => &
1137 procedure,
public :: is_max_final_obj => &
1139 generic,
public :: is_max_final => is_max_final_val, is_max_final_obj
1149 procedure,
public :: motivation_primary_calc => &
1167 real(
srp),
dimension(HISTORY_SIZE_MOTIVATION) :: hunger
1168 real(
srp),
dimension(HISTORY_SIZE_MOTIVATION) :: defence_fear
1173 character(len=LABEL_LENGTH),
dimension(HISTORY_SIZE_MOTIVATION) :: gos_main
1177 real(
srp),
dimension(HISTORY_SIZE_MOTIVATION) :: gos_arousal
1181 integer,
dimension(HISTORY_SIZE_MOTIVATION) :: gos_repeated
1196 procedure,
public :: get_hunger_mean => &
1201 procedure,
public :: get_active_avoid_mean => &
1206 procedure,
public :: get_reproduction_mean => &
1254 procedure,
public :: motivations_percept_components => &
1261 procedure,
public :: motivations_primary_calc => &
1270 procedure,
public :: modulation => &
1275 procedure,
public :: motivations_to_memory => &
1283 procedure,
public :: probability_reproduction => &
1307 character(len=LABEL_LENGTH) :: gos_main
1313 integer :: gos_repeated
1374 integer,
intent(in) :: maximum_number_food_items
1380 if (.not.
allocated(this%foods_seen)) &
1381 allocate(this%foods_seen(maximum_number_food_items))
1382 if (.not.
allocated(this%foods_distances)) &
1383 allocate(this%foods_distances(maximum_number_food_items))
1392 call this%foods_seen%create()
1395 this%foods_distances =
missing
1401 this%food_seen_count = maximum_number_food_items
1412 integer,
intent(in) :: number_set
1414 this%food_seen_count = number_set
1425 type(
food_item),
intent(in),
dimension(:) :: items
1429 real(SRP),
intent(in),
dimension(:) :: dist
1433 integer :: n_adjusted
1436 character(len=*),
parameter :: PROCNAME =
"(percept_food_make_fill_arrays)"
1441 check_conforming:
if (
size(items) /=
size(
dist))
then
1442 n_adjusted = (min(
size(items),
size(
dist)))
1444 call this%init(n_adjusted)
1446 call log_msg(
"WARNING: " // procname // &
1447 ": Non-conforming input arrays, re-initialised to " // &
1448 tostr(n_adjusted) //
" food items.")
1449 end if check_conforming
1453 this%foods_seen = items
1454 this%foods_distances =
dist
1462 integer :: count_obj
1464 count_obj = this%food_seen_count
1472 real(
srp) :: size_obj
1474 if (this%food_seen_count <1)
then
1477 size_obj =
average(this%foods_seen%size)
1486 real(
srp) :: mass_obj
1488 if (this%food_seen_count < 1)
then
1502 real(
srp) :: dist_obj
1504 if (this%food_seen_count <1)
then
1507 dist_obj =
average(this%foods_distances)
1517 if (
allocated(this%foods_seen))
deallocate(this%foods_seen)
1518 if (
allocated(this%foods_distances))
deallocate(this%foods_distances)
1519 this%food_seen_count =
unknown
1554 food_resource_available, &
1564 integer,
optional,
intent(in) :: time_step_model
1567 character(len=*),
parameter :: PROCNAME = &
1568 "(food_perception_get_visrange_objects)"
1577 type(
food_item),
dimension(size(food_resource_available%food)) :: dist_foods
1585 real(SRP),
dimension(size(food_resource_available%food)) :: &
1586 dist_food_neighbours
1590 integer,
dimension(size(food_resource_available%food)) :: dist_food_index
1593 logical :: dist_food_errflag
1598 real(SRP) :: irradiance_agent_depth
1604 real(SRP),
dimension(size(food_resource_available%food)) :: food_item_area
1609 real(SRP),
dimension(size(food_resource_available%food)) :: &
1610 food_item_visual_range
1618 type(
food_item),
dimension(FOOD_SELECT_ITEMS_INDEX_PARTIAL) :: &
1619 food_items_percept_in_visrange
1624 real(SRP),
dimension(FOOD_SELECT_ITEMS_INDEX_PARTIAL) :: &
1625 food_items_dist_sorted
1631 integer :: food_items_n_visrange
1634 integer :: time_step_model_here
1643 if (
present(time_step_model))
then
1644 time_step_model_here = time_step_model
1655 food_items_dist_sorted =
missing
1665 dist_foods = food_resource_available%food
1673 call this%neighbours( neighbours = dist_foods, &
1674 dist = dist_food_neighbours, &
1675 index_vector = dist_food_index, &
1677 error_flag = dist_food_errflag )
1679 if (dist_food_errflag)
call log_msg (
ltag_warn // procname // &
1680 ": Got error flag from food object neighbours procedure.")
1689 irradiance_agent_depth = this%illumination(time_step_model_here)
1700 food_item_visual_range( &
1704 irradiance = irradiance_agent_depth, &
1705 prey_area = food_item_area( &
1717 food_items_n_visrange = 0
1719 if ( dist_food_neighbours(dist_food_index(i)) < &
1720 food_item_visual_range(dist_food_index(i)) )
then
1722 if (dist_foods(dist_food_index(i))%is_available())
then
1723 food_items_n_visrange = food_items_n_visrange + 1
1724 food_items_percept_in_visrange(food_items_n_visrange) = &
1725 dist_foods(dist_food_index(i))
1726 food_items_dist_sorted(food_items_n_visrange) = &
1727 dist_food_neighbours(dist_food_index(i))
1730 "visual range but NOT available (eaten)." )
1737 ": No food items found within the visual range of the agent; " // &
1738 "The nearest food item distance=" // &
1739 tostr(dist_food_neighbours(dist_food_index(1))) // &
1740 ", with visual range=" // &
1741 tostr(food_item_visual_range(dist_food_index(1))) )
1750 call this%perceive_food%init(food_items_n_visrange)
1755 call this%perceive_food%make ( &
1756 food_items_percept_in_visrange(1:food_items_n_visrange), &
1757 food_items_dist_sorted(1:food_items_n_visrange) )
1769 logical :: sees_food
1772 if (this%perceive_food%get_count() > 0 ) sees_food = .
true.
1780 time_step_model )
result (capture_prob)
1783 integer,
optional,
intent(in) :: last
1787 integer,
optional,
intent(in) :: time_step_model
1792 real(
srp) :: capture_prob
1795 integer :: time_step_model_here
1801 type(
food_item) :: subjective_food_item_average
1805 if (
present(time_step_model))
then
1806 time_step_model_here = time_step_model
1822 if (
present(last))
then
1823 call subjective_food_item_average%make( &
1824 location = this%location(), &
1825 size = this%memory_stack%get_food_mean_size(last), &
1827 capture_prob = subjective_food_item_average%capture_probability( &
1828 distance = this%memory_stack%get_food_mean_dist(last), &
1829 time_step_model = time_step_model_here )
1831 call subjective_food_item_average%make( &
1832 location = this%location(), &
1833 size = this%memory_stack%get_food_mean_size(), &
1835 capture_prob = subjective_food_item_average%capture_probability( &
1836 distance = this%memory_stack%get_food_mean_dist(), &
1837 time_step_model = time_step_model_here )
1848 capture_prob) ), 0.0_srp, 1.0_srp )
1872 real(
srp) :: avail_capacity
1875 avail_capacity = this%capacity
1887 real(SRP),
intent(in) ::current_volume
1890 this%capacity = current_volume
1924 real(
srp) :: current
1927 current = this%body_mass
1938 real(SRP),
intent(in) ::current
1941 this%body_mass = current
1975 real(
srp) :: current
1978 current = this%energy_reserve
1988 real(SRP),
intent(in) ::current
1991 this%energy_reserve = current
2038 integer,
intent(in) ::current
2065 integer,
optional,
intent(in) :: id
2069 integer,
parameter :: HUGE_ID = huge(0)
2073 if (
present(id))
then
2076 this%cid = rand_i(1, huge_id)
2127 this%sex_is_male = .
true.
2139 type(
spatial),
intent(in) :: location
2144 real(SRP),
optional,
intent(in) :: size
2149 real(SRP),
optional,
intent(in) :: mass
2152 real(SRP),
optional,
intent(in) :: dist
2156 integer,
optional,
intent(in) :: cid
2159 logical,
optional,
intent(in) :: is_male
2164 call this%position(location)
2167 if (
present(cid))
then
2168 call this%set_cid(cid)
2175 if (
present(size))
then
2181 if (
present(mass))
then
2187 if (
present(
dist))
then
2188 this%consp_distance =
dist
2191 if (
present(is_male))
then
2192 this%sex_is_male = is_male
2202 real(
srp) :: body_size
2204 body_size = this%consp_body_size
2212 real(
srp) :: body_mass
2214 body_mass = this%consp_body_mass
2223 real(
srp) :: dist_consp
2225 dist_consp = this%consp_distance
2233 logical :: sex_is_male
2235 sex_is_male = this%sex_is_male
2243 logical :: sex_is_female
2245 if (this%sex_is_male)
then
2246 sex_is_female = .
false.
2248 sex_is_female = .
true.
2263 integer,
intent(in) :: maximum_number_conspecifics
2267 if (.not.
allocated(this%conspecifics_seen)) &
2268 allocate (this%conspecifics_seen(maximum_number_conspecifics))
2271 call this%conspecifics_seen%create()
2275 call this%number(maximum_number_conspecifics)
2288 integer,
intent(in) :: number_set
2290 this%conspecifics_seen_count = number_set
2305 character(len=*),
parameter ::
procname =
"(percept_consp_make_fill_arrays)"
2310 this%conspecifics_seen = consps
2318 integer :: count_obj
2320 count_obj = this%conspecifics_seen_count
2329 if (
allocated(this%conspecifics_seen))
deallocate(this%conspecifics_seen)
2330 this%conspecifics_seen_count =
unknown
2354 class(
condition),
dimension(:),
intent(in) :: consp_agents
2357 integer,
optional,
intent(in) :: time_step_model
2362 real(SRP),
dimension(size(consp_agents)) :: consp_sizes
2366 real(SRP),
dimension(size(consp_agents)) :: consp_masses
2371 logical,
dimension(size(consp_agents)) :: consp_alive
2375 logical,
dimension(size(consp_agents)) :: consp_sex_is_male
2378 integer :: time_step_model_here
2383 character(len=*),
parameter :: PROCNAME = &
2384 "(consp_perception_get_visrange_objects)"
2398 real(SRP),
parameter :: MIN_DIST_SELF = 2.0_srp *
zero
2402 type(
spatial),
dimension(size(consp_agents)) :: agents_near
2406 real(SRP),
dimension(size(consp_agents)) :: dist_neighbours
2410 integer,
dimension(size(consp_agents)) :: dist_index
2418 real(SRP) :: irradiance_agent_depth
2422 real(SRP),
dimension(size(consp_agents)) :: sobject_area
2427 real(SRP),
dimension(size(consp_agents)) :: sobject_visual_range
2436 sobjects_percept_in_visrange
2441 real(SRP),
dimension(CONSP_SELECT_ITEMS_INDEX_PARTIAL) :: &
2442 sobjects_dist_sorted
2447 integer :: consp_array_size
2452 integer :: sobjects_n_visrange
2470 sobjects_dist_sorted =
missing
2476 if (
present(time_step_model))
then
2477 time_step_model_here = time_step_model
2484 consp_array_size =
size(consp_agents)
2488 call agents_near%position ( consp_agents%location() )
2492 consp_sizes = consp_agents%get_length()
2493 consp_masses = consp_agents%get_mass()
2494 consp_alive = consp_agents%is_alive()
2495 consp_sex_is_male = consp_agents%is_male()
2504 call this%neighbours( neighbours = agents_near, &
2505 dist = dist_neighbours, &
2506 index_vector = dist_index, &
2508 error_flag = err_flag )
2510 if (err_flag)
call log_msg (
ltag_warn // procname //
": Got error flag" &
2511 //
" from conspecific objects neighbours procedure.")
2520 irradiance_agent_depth = this%illumination(time_step_model_here)
2532 irradiance = irradiance_agent_depth, &
2533 prey_area = sobject_area( &
2546 sobjects_n_visrange = 0
2548 if ( dist_neighbours(dist_index(i)) < &
2549 sobject_visual_range(dist_index(i)) )
then
2553 if ( this%distance( agents_near(dist_index(i)) ) > min_dist_self )
then
2555 if ( consp_alive(dist_index(i)) )
then
2556 sobjects_n_visrange = sobjects_n_visrange + 1
2557 call sobjects_percept_in_visrange(sobjects_n_visrange)%make( &
2558 location = agents_near(dist_index(i))%location(), &
2559 size = consp_sizes(dist_index(i)), &
2560 mass = consp_masses(dist_index(i)), &
2561 dist = dist_neighbours(dist_index(i)), &
2562 cid = dist_index(i), &
2563 is_male = consp_sex_is_male(dist_index(i)) )
2566 ": Dead neighbour excluded. Id:" // &
2567 tostr(dist_index(i)) )
2572 "the visual range. Idx:" // tostr(dist_index(self_idx)))
2580 ": No conspecifics found within the visual range of the agent; " // &
2581 "The nearest conspecific distance=" // &
2582 tostr(dist_neighbours(dist_index(self_idx+1))) // &
2583 ", with visual range=" // &
2584 tostr(sobject_visual_range(dist_index(self_idx+1))) // &
2585 ", ID:" // tostr(dist_index(self_idx+1)) // &
2586 ", Idx:" // tostr(self_idx+1) )
2596 call this%perceive_consp%init(sobjects_n_visrange)
2601 call this%perceive_consp%make ( &
2602 sobjects_percept_in_visrange(1:sobjects_n_visrange) )
2616 logical :: sees_consp
2618 sees_consp = .
false.
2619 if (this%perceive_consp%get_count() > 0 ) sees_consp = .
true.
2658 type(
spatial),
intent(in) :: location
2661 real(SRP),
optional,
intent(in) :: size
2664 real(SRP),
optional,
intent(in) :: dist
2667 integer,
optional,
intent(in) :: cid
2672 call this%position(location)
2675 if (
present(cid))
then
2676 call this%set_cid(cid)
2682 if (
present(size))
then
2683 this%sobj_size = max(
zero, size)
2688 if (
present(
dist))
then
2689 this%sobj_distance =
dist
2699 real(
srp) :: obj_size
2701 obj_size = this%sobj_size
2710 real(
srp) :: dist_object
2712 dist_object = this%sobj_distance
2728 contrast, time_step_model)
result (visrange)
2736 real(
srp),
optional,
intent(in) :: object_area
2740 real(
srp),
optional,
intent(in) :: contrast
2744 integer,
optional,
intent(in) :: time_step_model
2746 real(
srp) :: visrange
2749 integer :: time_step_model_here
2750 real(
srp) :: object_area_here, contrast_here
2753 real(
srp) :: irradiance_agent_depth
2758 if (
present(contrast))
then
2759 contrast_here = contrast
2765 if (
present(time_step_model))
then
2766 time_step_model_here = time_step_model
2775 if (
present(object_area))
then
2776 object_area_here = object_area
2783 irradiance_agent_depth = this%illumination(time_step_model_here)
2787 prey_area = object_area_here, &
2788 prey_contrast = contrast_here ) )
2806 integer,
intent(in) :: maximum_number_predators
2810 if (.not.
allocated(this%predators_seen)) &
2811 allocate(this%predators_seen(maximum_number_predators))
2814 if (.not.
allocated(this%predators_attack_rates)) &
2815 allocate(this%predators_attack_rates(maximum_number_predators))
2818 call this%predators_seen%create()
2822 this%predators_attack_rates =
missing
2826 call this%number(maximum_number_predators)
2839 integer,
intent(in) :: number_set
2841 this%predators_seen_count = number_set
2856 real(
srp),
optional,
intent(in),
dimension(:) :: attack_rate
2859 character(len=*),
parameter ::
procname = &
2860 "(percept_predator_make_fill_arrays)"
2865 this%predators_seen = preds
2871 if (
present(attack_rate))
then
2872 this%predators_attack_rates = attack_rate
2884 real(
srp),
intent(in),
dimension(:) :: attack_rate
2886 this%predators_attack_rates = attack_rate
2895 real(
srp),
intent(in) :: attack_rate
2897 this%predators_attack_rates = attack_rate
2905 integer :: count_obj
2907 count_obj = this%predators_seen_count
2916 if (
allocated(this%predators_seen))
deallocate(this%predators_seen)
2917 if (
allocated(this%predators_attack_rates))
deallocate(this%predators_attack_rates)
2918 this%predators_seen_count =
unknown
2944 class(
predator),
dimension(:),
intent(in) :: spatl_agents
2947 integer,
optional,
intent(in) :: time_step_model
2950 integer :: time_step_model_here
2955 character(len=*),
parameter :: PROCNAME = &
2956 "(predator_perception_get_visrange_objects)"
2970 real(SRP),
parameter :: MIN_DIST_SELF = 0.001_srp
2974 type(
spatial),
dimension(size(spatl_agents)) :: agents_near
2978 real(SRP),
dimension(size(spatl_agents)) :: dist_neighbours
2982 integer,
dimension(size(spatl_agents)) :: dist_index
2990 real(SRP) :: irradiance_agent_depth
2993 real(SRP),
dimension(size(spatl_agents)) :: spatl_sizes
2996 real(SRP),
dimension(size(spatl_agents)) :: pred_attack_rates
3001 real(SRP),
dimension(size(spatl_agents)) :: sobject_area
3006 real(SRP),
dimension(size(spatl_agents)) :: sobject_visual_range
3022 real(SRP) ,
dimension( &
PRED_SELECT_ITEMS_INDEX_PARTIAL) :: pred_attack_rates_in_visrange
3027 integer :: index_max_size
3033 integer :: sobjects_n_visrange
3049 if (
present(time_step_model))
then
3050 time_step_model_here = time_step_model
3073 call agents_near%position ( spatl_agents%location() )
3077 spatl_sizes = spatl_agents%get_size()
3081 pred_attack_rates = spatl_agents%get_attack_rate()
3103 call this%neighbours( neighbours = agents_near, &
3104 dist = dist_neighbours, &
3105 index_vector = dist_index, &
3106 error_flag = err_flag )
3110 call this%neighbours( neighbours = agents_near, &
3111 dist = dist_neighbours, &
3112 index_vector = dist_index, &
3114 error_flag = err_flag )
3116 if (err_flag)
call log_msg (
ltag_warn // procname //
": Got error flag" &
3117 //
" from conspecific objects neighbours procedure.")
3126 irradiance_agent_depth = this%illumination(time_step_model_here)
3131 sobject_area(dist_index(1:index_max_size)) = &
3133 cm2m( spatl_sizes(dist_index(1:index_max_size)) ) &
3138 sobject_visual_range(dist_index(1:index_max_size)) &
3140 irradiance = irradiance_agent_depth, &
3141 prey_area = sobject_area( &
3142 dist_index(1:index_max_size) &
3154 sobjects_n_visrange = 0
3155 do i=1, index_max_size
3156 if ( dist_neighbours(dist_index(i)) < &
3157 sobject_visual_range(dist_index(i)) )
then
3158 sobjects_n_visrange = sobjects_n_visrange + 1
3159 call sobjects_percept_in_visrange(sobjects_n_visrange)%make( &
3160 location = agents_near(dist_index(i))%location(), &
3161 size = spatl_sizes(dist_index(i)), &
3162 dist = dist_neighbours(dist_index(i)), &
3163 cid = dist_index(i) )
3167 pred_attack_rates_in_visrange(sobjects_n_visrange) = &
3168 pred_attack_rates(dist_index(i))
3174 ": No objects found within the visual range of the agent; " // &
3175 "The nearest object distance=" // &
3176 tostr(dist_neighbours(dist_index(1))) // &
3177 ", with visual range=" // &
3178 tostr(sobject_visual_range(dist_index(1))) // &
3179 ", ID:" // tostr(dist_index(1)) )
3188 call this%perceive_predator%init(sobjects_n_visrange)
3201 call this%perceive_predator%make ( &
3202 sobjects_percept_in_visrange(1:sobjects_n_visrange), &
3203 pred_attack_rates_in_visrange(1:sobjects_n_visrange) )
3210 call this%perceive_predator%make ( &
3211 sobjects_percept_in_visrange(1:sobjects_n_visrange) )
3227 logical :: sees_pred
3230 if (this%perceive_predator%get_count() > 0 ) sees_pred = .
true.
3252 real(
srp) :: illumination_here
3254 illumination_here = this%illumination
3262 integer,
intent(in) :: timestep
3263 real(SRP),
intent(in) :: depth
3295 integer,
optional,
intent(in) :: time_step_model
3298 integer :: time_step_model_here
3302 if (
present(time_step_model))
then
3303 time_step_model_here = time_step_model
3310 call this%perceive_light%init()
3312 call this%perceive_light%set_current( time_step_model_here, this%dpos() )
3336 depth_now = this%depth
3344 real(SRP),
intent(in) :: cdepth
3380 rf_now = this%reproduct_fact
3388 real(SRP),
intent(in) :: reprfac
3390 this%reproduct_fact = reprfac
3416 call this%perceive_depth%init()
3418 call this%perceive_depth%set_current( this%dpos() )
3430 call this%perceive_stomach%init()
3436 call this%perceive_stomach%set_available( this%body_mass * this%maxstomcap &
3437 - this%get_stom_content() )
3449 call this%perceive_body_mass%init()
3452 call this%perceive_body_mass%set_current( this%mass() )
3464 call this%perceive_energy%init()
3468 call this%perceive_energy%set_current( this%get_energy() )
3480 call this%perceive_age%init()
3484 call this%perceive_age%set_current( this%get_age() )
3496 call this%perceive_reprfac%init()
3500 call this%perceive_reprfac%set_current( this%reproductive_factor() )
3512 foodsize, fooddist, consp, pred, stom, bdmass, energ, reprfac )
3518 real(
srp),
intent(in) :: light
3519 real(
srp),
intent(in) :: depth
3520 integer ,
intent(in) :: food
3521 real(
srp),
intent(in) :: foodsize
3522 real(
srp),
intent(in) :: fooddist
3523 integer ,
intent(in) :: consp
3524 integer ,
intent(in) :: pred
3525 real(
srp),
intent(in) :: stom
3526 real(
srp),
intent(in) :: bdmass
3527 real(
srp),
intent(in) :: energ
3528 real(
srp),
intent(in) :: reprfac
3574 integer :: total_count
3577 total_count = sum(this%memory_food, this%memory_food /=
unknown)
3598 integer,
optional,
intent(in) :: last
3601 real(
srp) :: mean_count
3604 integer :: last_here
3608 integer,
parameter :: hist_size = size(this%memory_food)
3614 if (
present(last))
then
3615 if ( last < hist_size )
then
3618 last_here = hist_size - 1
3621 last_here = hist_size - 1
3626 mean_count=
average( this%memory_food( hist_size-last_here+1:hist_size ), &
3627 undef_ret_null=.
true. )
3647 split_val, older, newer )
3651 integer,
optional,
intent(in) :: window
3655 integer,
optional,
intent(in) :: split_val
3658 real(
srp),
intent(out) :: older
3661 real(
srp),
intent(out) :: newer
3664 integer :: window_loc, split_val_loc
3666 integer,
parameter :: hist_size = size(this%memory_food)
3671 if (
present(window))
then
3675 if (window_loc >= hist_size) window_loc = hist_size
3679 window_loc = hist_size
3682 if (
present(split_val))
then
3683 split_val_loc = split_val
3687 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
3692 if (split_val_loc >= window_loc) &
3693 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
3715 older=
average( this%memory_food(hist_size-window_loc+1 : &
3716 hist_size-window_loc+split_val_loc), &
3717 undef_ret_null=.
true. )
3719 newer=
average( this%memory_food(hist_size-window_loc+split_val_loc+1 : &
3721 undef_ret_null=.
true. )
3742 integer,
optional,
intent(in) :: last
3745 real(
srp) :: mean_val
3748 integer :: last_here
3752 integer,
parameter :: hist_size = size(this%memory_foodsiz)
3758 if (
present(last))
then
3759 if ( last < hist_size )
then
3762 last_here = hist_size
3765 last_here = hist_size
3770 mean_val =
average(this%memory_foodsiz(hist_size-last_here+1:hist_size), &
3771 undef_ret_null=.
true.)
3791 split_val, older, newer )
3795 integer,
optional,
intent(in) :: window
3799 integer,
optional,
intent(in) :: split_val
3802 real(
srp),
intent(out) :: older
3805 real(
srp),
intent(out) :: newer
3808 integer :: window_loc, split_val_loc
3810 integer,
parameter :: hist_size = size(this%memory_foodsiz)
3815 if (
present(window))
then
3819 if (window_loc >= hist_size) window_loc = hist_size
3823 window_loc = hist_size
3826 if (
present(split_val))
then
3827 split_val_loc = split_val
3831 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
3836 if (split_val_loc >= window_loc) &
3837 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
3859 older=
average( this%memory_foodsiz(hist_size-window_loc+1 : &
3860 hist_size-window_loc+split_val_loc), &
3861 undef_ret_null=.
true. )
3863 newer=
average( this%memory_foodsiz(hist_size-window_loc+split_val_loc+1 : &
3865 undef_ret_null=.
true. )
3882 undef_ret_null)
result (mean_val)
3885 integer,
optional,
intent(in) :: last
3892 logical,
optional,
intent(in) :: undef_ret_null
3894 real(
srp) :: mean_val
3897 logical :: undef_ret_null_loc
3898 integer :: last_here
3902 integer,
parameter :: hist_size = size(this%memory_foodist)
3908 if (
present(last))
then
3909 if ( last < hist_size )
then
3912 last_here = hist_size
3915 last_here = hist_size
3918 if (
present(undef_ret_null))
then
3919 undef_ret_null_loc = undef_ret_null
3921 undef_ret_null_loc = .
true.
3926 mean_val =
average(this%memory_foodist(hist_size-last_here+1:hist_size), &
3927 undef_ret_null=undef_ret_null_loc)
3947 split_val, older, newer )
3951 integer,
optional,
intent(in) :: window
3955 integer,
optional,
intent(in) :: split_val
3958 real(
srp),
intent(out) :: older
3961 real(
srp),
intent(out) :: newer
3964 integer :: window_loc, split_val_loc
3966 integer,
parameter :: hist_size = size(this%memory_foodist)
3971 if (
present(window))
then
3975 if (window_loc >= hist_size) window_loc = hist_size
3979 window_loc = hist_size
3982 if (
present(split_val))
then
3983 split_val_loc = split_val
3987 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
3992 if (split_val_loc >= window_loc) &
3993 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
4015 older=
average( this%memory_foodist(hist_size-window_loc+1 : &
4016 hist_size-window_loc+split_val_loc), &
4017 undef_ret_null=.
true. )
4019 newer=
average( this%memory_foodist(hist_size-window_loc+split_val_loc+1 : &
4021 undef_ret_null=.
true. )
4033 integer,
optional,
intent(in) :: last
4036 real(
srp) :: mean_count
4039 integer :: last_here
4043 integer,
parameter :: hist_size = size(this%memory_consp)
4049 if (
present(last))
then
4050 if ( last < hist_size )
then
4053 last_here = hist_size - 1
4056 last_here = hist_size - 1
4061 mean_count=
average( this%memory_consp( hist_size-last_here+1:hist_size ), &
4062 undef_ret_null=.
true. )
4072 integer :: total_count
4075 total_count = sum(this%memory_pred, this%memory_pred /=
unknown)
4097 integer,
optional,
intent(in) :: last
4100 real(
srp) :: mean_count
4103 integer :: last_here
4107 integer,
parameter :: hist_size = size(this%memory_pred)
4112 if (
present(last))
then
4113 if ( last < hist_size )
then
4116 last_here = hist_size
4119 last_here = hist_size
4123 mean_count=
average(this%memory_pred( hist_size-last_here+1:hist_size ), &
4124 undef_ret_null=.
true. )
4144 split_val, older, newer)
4148 integer,
optional,
intent(in) :: window
4152 integer,
optional,
intent(in) :: split_val
4155 real(
srp),
intent(out) :: older
4158 real(
srp),
intent(out) :: newer
4161 integer :: window_loc, split_val_loc
4163 integer,
parameter :: hist_size = size(this%memory_pred)
4168 if (
present(window))
then
4172 if (window_loc >= hist_size) window_loc = hist_size
4176 window_loc = hist_size
4179 if (
present(split_val))
then
4180 split_val_loc = split_val
4184 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
4189 if (split_val_loc >= window_loc) &
4190 split_val_loc = floor( real( window_loc,
srp ) / 2.0 )
4212 older=
average( this%memory_pred(hist_size-window_loc+1 : &
4213 hist_size-window_loc+split_val_loc), &
4214 undef_ret_null=.
true. )
4216 newer=
average( this%memory_pred(hist_size-window_loc+split_val_loc+1 : &
4218 undef_ret_null=.
true. )
4232 call this%memory_stack%add_to_memory( &
4233 light = this%perceive_light%get_current(), &
4234 depth = this%perceive_depth%get_current(), &
4235 food = this%perceive_food%get_count(), &
4236 foodsize = this%perceive_food%get_meansize(), &
4237 fooddist = this%perceive_food%get_meandist(), &
4238 consp = this%perceive_consp%get_count(), &
4239 pred = this%perceive_predator%get_count(), &
4240 stom = this%perceive_stomach%get_available(), &
4241 bdmass = this%perceive_body_mass%get_current(), &
4242 energ = this%perceive_energy%get_current(), &
4243 reprfac= this%perceive_reprfac%get_current() &
4261 call this%feel_light()
4262 call this%feel_depth()
4300 call this%feel_stomach()
4301 call this%feel_bodymass()
4302 call this%feel_energy()
4303 call this%feel_age()
4304 call this%feel_repfac()
4315 call this%perceive_light%init()
4316 call this%perceive_depth%init()
4317 call this%perceive_food%init(0)
4318 call this%perceive_consp%init(0)
4319 call this%perceive_predator%init(0)
4320 call this%perceive_stomach%init()
4321 call this%perceive_body_mass%init()
4322 call this%perceive_energy%init()
4323 call this%perceive_age%init()
4324 call this%perceive_reprfac%init()
4327 call this%memory_stack%memory_cleanup()
4336 logical,
optional,
intent(in) :: clean_memory
4339 call this%perceive_light%destroy()
4340 call this%perceive_depth%destroy()
4341 call this%perceive_food%destroy()
4342 call this%perceive_consp%destroy()
4343 call this%perceive_predator%destroy()
4344 call this%perceive_stomach%destroy()
4345 call this%perceive_body_mass%destroy()
4346 call this%perceive_energy%destroy()
4347 call this%perceive_age%destroy()
4348 call this%perceive_reprfac%destroy()
4351 if (
present(clean_memory))
then
4352 if (clean_memory)
call this%memory_stack%memory_cleanup()
4371 result(predation_risk)
4375 real(
srp) :: predation_risk
4402 this%perceive_predator%get_count(), &
4403 this%memory_stack%get_pred_mean(mem_wind), &
4418 integer,
intent(in) :: pred_count
4423 real(
srp),
intent(in) :: pred_memory_mean
4429 real(
srp),
optional,
intent(in) :: weight_direct
4433 real(
srp) :: weight_direct_loc
4440 if (
present(weight_direct))
then
4441 weight_direct_loc = weight_direct
4451 risk = real(pred_count,
srp) * weight_direct + &
4452 pred_memory_mean * (1.0_srp - weight_direct)
4493 real(
srp),
optional,
intent(in) :: all_vals_fix
4498 logical,
optional,
intent(in) :: all_one
4502 real(
srp),
optional,
intent(in) :: &
4503 weight_light, weight_depth, &
4504 weight_food_dir, weight_food_mem, &
4505 weight_conspec, weight_pred_dir, weight_predator, &
4506 weight_stomach, weight_bodymass, &
4507 weight_energy, weight_age, &
4512 here_weight_light, here_weight_depth, &
4513 here_weight_food_dir, here_weight_food_mem, &
4514 here_weight_conspec, here_weight_pred_dir, here_weight_predator, &
4515 here_weight_stomach, here_weight_bodymass, &
4516 here_weight_energy, here_weight_age, &
4519 real(
srp),
parameter :: p1 = 1.0_srp
4520 real(
srp),
parameter :: p0 = 0.0_srp
4525 if (
present(all_vals_fix))
then
4526 this%light = all_vals_fix
4527 this%depth = all_vals_fix
4528 this%food_dir = all_vals_fix
4529 this%food_mem = all_vals_fix
4530 this%conspec = all_vals_fix
4531 this%pred_dir = all_vals_fix
4532 this%predator = all_vals_fix
4533 this%stomach = all_vals_fix
4534 this%bodymass = all_vals_fix
4535 this%energy = all_vals_fix
4536 this%age = all_vals_fix
4537 this%reprfac = all_vals_fix
4543 if (
present(all_one))
then
4563 if (
present(weight_light) )
then
4564 here_weight_light = weight_light
4566 here_weight_light = p0
4569 if (
present(weight_depth) )
then
4570 here_weight_depth = weight_depth
4572 here_weight_depth = p0
4575 if (
present(weight_food_dir) )
then
4576 here_weight_food_dir = weight_food_dir
4578 here_weight_food_dir = p0
4581 if (
present(weight_food_mem) )
then
4582 here_weight_food_mem = weight_food_mem
4584 here_weight_food_mem = p0
4587 if (
present(weight_conspec) )
then
4588 here_weight_conspec = weight_conspec
4590 here_weight_conspec = p0
4593 if (
present(weight_pred_dir) )
then
4594 here_weight_pred_dir = weight_pred_dir
4596 here_weight_pred_dir = p0
4599 if (
present(weight_predator) )
then
4600 here_weight_predator = weight_predator
4602 here_weight_predator = p0
4605 if (
present(weight_stomach) )
then
4606 here_weight_stomach = weight_stomach
4608 here_weight_stomach = p0
4611 if (
present(weight_bodymass) )
then
4612 here_weight_bodymass = weight_bodymass
4614 here_weight_bodymass = p0
4617 if (
present(weight_energy) )
then
4618 here_weight_energy = weight_energy
4620 here_weight_energy = p0
4623 if (
present(weight_age) )
then
4624 here_weight_age = weight_age
4626 here_weight_age = p0
4629 if (
present(weight_reprfac) )
then
4630 here_weight_reprfac = weight_reprfac
4632 here_weight_reprfac = p0
4638 this%light = here_weight_light
4639 this%depth = here_weight_depth
4640 this%food_dir = here_weight_food_dir
4641 this%food_mem = here_weight_food_mem
4642 this%conspec = here_weight_conspec
4643 this%pred_dir = here_weight_pred_dir
4644 this%predator = here_weight_predator
4645 this%stomach = here_weight_stomach
4646 this%bodymass = here_weight_bodymass
4647 this%energy = here_weight_energy
4648 this%age = here_weight_age
4649 this%reprfac = here_weight_reprfac
4668 ! Boolean G x P matrices:
4669 param_gp_matrix_light, &
4670 param_gp_matrix_depth, &
4671 param_gp_matrix_food_dir, &
4672 param_gp_matrix_food_mem, &
4673 param_gp_matrix_conspec, &
4674 param_gp_matrix_pred_dir, &
4675 param_gp_matrix_predator, &
4676 param_gp_matrix_stomach, &
4677 param_gp_matrix_bodymass, &
4678 param_gp_matrix_energy, &
4679 param_gp_matrix_age, &
4680 param_gp_matrix_reprfac, &
4682 param_gerror_cv_light, &
4683 param_gerror_cv_depth, &
4684 param_gerror_cv_food_dir, &
4685 param_gerror_cv_food_mem, &
4686 param_gerror_cv_conspec, &
4687 param_gerror_cv_pred_dir, &
4688 param_gerror_cv_predator, &
4689 param_gerror_cv_stomach, &
4690 param_gerror_cv_bodymass, &
4691 param_gerror_cv_energy, &
4692 param_gerror_cv_age, &
4693 param_gerror_cv_reprfac, &
4695 param_gene_label_light, &
4696 param_gene_label_depth, &
4697 param_gene_label_food_dir, &
4698 param_gene_label_food_mem, &
4699 param_gene_label_conspec, &
4700 param_gene_label_pred_dir, &
4701 param_gene_label_predator, &
4702 param_gene_label_stomach, &
4703 param_gene_label_bodymass, &
4704 param_gene_label_energy, &
4705 param_gene_label_age, &
4706 param_gene_label_reprfac )
4710 class(
appraisal),
intent(inout) :: this_agent
4750 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
optional,
intent(in) :: &
4751 param_gp_matrix_light, &
4752 param_gp_matrix_depth, &
4753 param_gp_matrix_food_dir, &
4754 param_gp_matrix_food_mem, &
4755 param_gp_matrix_conspec, &
4756 param_gp_matrix_pred_dir, &
4757 param_gp_matrix_predator, &
4758 param_gp_matrix_stomach, &
4759 param_gp_matrix_bodymass, &
4760 param_gp_matrix_energy, &
4761 param_gp_matrix_age, &
4762 param_gp_matrix_reprfac
4795 real(SRP),
optional,
intent(in) :: param_gerror_cv_light, &
4796 param_gerror_cv_depth, &
4797 param_gerror_cv_food_dir, &
4798 param_gerror_cv_food_mem, &
4799 param_gerror_cv_conspec, &
4800 param_gerror_cv_pred_dir, &
4801 param_gerror_cv_predator, &
4802 param_gerror_cv_stomach, &
4803 param_gerror_cv_bodymass, &
4804 param_gerror_cv_energy, &
4805 param_gerror_cv_age, &
4806 param_gerror_cv_reprfac
4826 character(len=*),
optional,
intent(in) :: param_gene_label_light, &
4827 param_gene_label_depth, &
4828 param_gene_label_food_dir, &
4829 param_gene_label_food_mem, &
4830 param_gene_label_conspec, &
4831 param_gene_label_pred_dir, &
4832 param_gene_label_predator, &
4833 param_gene_label_stomach, &
4834 param_gene_label_bodymass, &
4835 param_gene_label_energy, &
4836 param_gene_label_age, &
4837 param_gene_label_reprfac
4843 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES) :: &
4844 here_param_gp_matrix_light, &
4845 here_param_gp_matrix_depth, &
4846 here_param_gp_matrix_food_dir, &
4847 here_param_gp_matrix_food_mem, &
4848 here_param_gp_matrix_conspec, &
4849 here_param_gp_matrix_pred_dir, &
4850 here_param_gp_matrix_predator, &
4851 here_param_gp_matrix_stomach, &
4852 here_param_gp_matrix_bodymass, &
4853 here_param_gp_matrix_energy, &
4854 here_param_gp_matrix_age, &
4855 here_param_gp_matrix_reprfac
4858 real(SRP) :: here_param_gerror_cv_light, &
4859 here_param_gerror_cv_depth, &
4860 here_param_gerror_cv_food_dir, &
4861 here_param_gerror_cv_food_mem, &
4862 here_param_gerror_cv_conspec, &
4863 here_param_gerror_cv_pred_dir, &
4864 here_param_gerror_cv_predator, &
4865 here_param_gerror_cv_stomach, &
4866 here_param_gerror_cv_bodymass, &
4867 here_param_gerror_cv_energy, &
4868 here_param_gerror_cv_age, &
4869 here_param_gerror_cv_reprfac
4881 light:
if (
present(param_gp_matrix_light))
then
4882 here_param_gp_matrix_light = param_gp_matrix_light
4883 if (
present(param_gerror_cv_light))
then
4884 here_param_gerror_cv_light = param_gerror_cv_light
4886 here_param_gerror_cv_light = 0.0_srp
4889 if (
present(param_gene_label_light))
then
4894 call this_agent%neuro_resp( &
4895 this_trait = this%light, &
4896 g_p_matrix = here_param_gp_matrix_light, &
4897 init_val = this_agent%perceive_light%get_current(), &
4898 gerror_cv = here_param_gerror_cv_light, &
4899 label = param_gene_label_light )
4903 call this_agent%neuro_resp( &
4904 this_trait = this%light, &
4905 g_p_matrix = here_param_gp_matrix_light, &
4906 init_val = this_agent%perceive_light%get_current(), &
4907 gerror_cv = here_param_gerror_cv_light )
4911 depth:
if (
present(param_gp_matrix_depth))
then
4912 here_param_gp_matrix_depth = param_gp_matrix_depth
4913 if (
present(param_gerror_cv_depth))
then
4914 here_param_gerror_cv_depth = param_gerror_cv_depth
4916 here_param_gerror_cv_depth = 0.0_srp
4919 if (
present(param_gene_label_depth))
then
4922 call this_agent%neuro_resp( &
4923 this_trait = this%depth, &
4924 g_p_matrix = here_param_gp_matrix_depth, &
4925 init_val = this_agent%perceive_depth%get_current(), &
4926 gerror_cv = here_param_gerror_cv_depth, &
4927 label = param_gene_label_depth )
4931 call this_agent%neuro_resp( &
4932 this_trait = this%depth, &
4933 g_p_matrix = here_param_gp_matrix_depth, &
4934 init_val = this_agent%perceive_depth%get_current(), &
4935 gerror_cv = here_param_gerror_cv_depth )
4939 food_dir:
if (
present(param_gp_matrix_food_dir))
then
4940 here_param_gp_matrix_food_dir = param_gp_matrix_food_dir
4941 if (
present(param_gerror_cv_food_dir))
then
4942 here_param_gerror_cv_food_dir = param_gerror_cv_food_dir
4944 here_param_gerror_cv_food_dir = 0.0_srp
4947 if (
present(param_gene_label_food_dir))
then
4950 call this_agent%neuro_resp( &
4951 this_trait = this%food_dir, &
4952 g_p_matrix = here_param_gp_matrix_food_dir, &
4953 init_val = real(this_agent%perceive_food%get_count(), srp), &
4954 gerror_cv = here_param_gerror_cv_food_dir, &
4955 label = param_gene_label_food_dir )
4959 call this_agent%neuro_resp( &
4960 this_trait = this%food_dir, &
4961 g_p_matrix = here_param_gp_matrix_food_dir, &
4962 init_val = real(this_agent%perceive_food%get_count(), srp), &
4963 gerror_cv = here_param_gerror_cv_food_dir )
4967 food_mem:
if (
present(param_gp_matrix_food_mem))
then
4968 here_param_gp_matrix_food_mem = param_gp_matrix_food_mem
4969 if (
present(param_gerror_cv_food_mem))
then
4970 here_param_gerror_cv_food_mem = param_gerror_cv_food_mem
4972 here_param_gerror_cv_food_mem = 0.0_srp
4975 if (
present(param_gene_label_food_mem))
then
4978 call this_agent%neuro_resp( &
4979 this_trait = this%food_mem, &
4980 g_p_matrix = here_param_gp_matrix_food_mem, &
4981 init_val = this_agent%memory_stack%get_food_mean_n(), &
4982 gerror_cv = here_param_gerror_cv_food_mem, &
4983 label = param_gene_label_food_mem )
4987 call this_agent%neuro_resp( &
4988 this_trait = this%food_mem, &
4989 g_p_matrix = here_param_gp_matrix_food_mem, &
4990 init_val = this_agent%memory_stack%get_food_mean_n(), &
4991 gerror_cv = here_param_gerror_cv_food_mem )
4995 conspec:
if (
present(param_gp_matrix_conspec))
then
4996 here_param_gp_matrix_conspec = param_gp_matrix_conspec
4997 if (
present(param_gerror_cv_conspec))
then
4998 here_param_gerror_cv_conspec = param_gerror_cv_conspec
5000 here_param_gerror_cv_conspec = 0.0_srp
5003 if (
present(param_gene_label_conspec))
then
5006 call this_agent%neuro_resp( &
5007 this_trait = this%conspec, &
5008 g_p_matrix = here_param_gp_matrix_conspec, &
5009 init_val = real(this_agent%perceive_consp%get_count(), srp), &
5010 gerror_cv = here_param_gerror_cv_conspec, &
5011 label = param_gene_label_conspec )
5015 call this_agent%neuro_resp( &
5016 this_trait = this%conspec, &
5017 g_p_matrix = here_param_gp_matrix_conspec, &
5018 init_val = real(this_agent%perceive_consp%get_count(), srp), &
5019 gerror_cv = here_param_gerror_cv_conspec )
5023 pred_dir:
if (
present(param_gp_matrix_pred_dir))
then
5024 here_param_gp_matrix_pred_dir = param_gp_matrix_pred_dir
5025 if (
present(param_gerror_cv_pred_dir))
then
5026 here_param_gerror_cv_pred_dir = param_gerror_cv_pred_dir
5028 here_param_gerror_cv_pred_dir = 0.0_srp
5031 if (
present(param_gene_label_pred_dir))
then
5034 call this_agent%neuro_resp( &
5035 this_trait = this%pred_dir, &
5036 g_p_matrix = here_param_gp_matrix_pred_dir, &
5037 init_val = this_agent%risk_pred(), &
5038 gerror_cv = here_param_gerror_cv_pred_dir, &
5039 label = param_gene_label_pred_dir )
5043 call this_agent%neuro_resp( &
5044 this_trait = this%pred_dir, &
5045 g_p_matrix = here_param_gp_matrix_pred_dir, &
5046 init_val = this_agent%risk_pred(), &
5047 gerror_cv = here_param_gerror_cv_pred_dir )
5051 predator:
if (
present(param_gp_matrix_predator))
then
5052 here_param_gp_matrix_predator = param_gp_matrix_predator
5053 if (
present(param_gerror_cv_predator))
then
5054 here_param_gerror_cv_predator = param_gerror_cv_predator
5056 here_param_gerror_cv_predator = 0.0_srp
5059 if (
present(param_gene_label_predator))
then
5062 call this_agent%neuro_resp( &
5063 this_trait = this%predator, &
5064 g_p_matrix = here_param_gp_matrix_predator, &
5065 init_val = this_agent%predation_risk(), &
5066 gerror_cv = here_param_gerror_cv_predator, &
5067 label = param_gene_label_predator )
5071 call this_agent%neuro_resp( &
5072 this_trait = this%predator, &
5073 g_p_matrix = here_param_gp_matrix_predator, &
5074 init_val = this_agent%predation_risk(), &
5075 gerror_cv = here_param_gerror_cv_predator )
5079 stomach:
if (
present(param_gp_matrix_stomach))
then
5080 here_param_gp_matrix_stomach = param_gp_matrix_stomach
5081 if (
present(param_gerror_cv_stomach))
then
5082 here_param_gerror_cv_stomach = param_gerror_cv_stomach
5084 here_param_gerror_cv_stomach = 0.0_srp
5087 if (
present(param_gene_label_stomach))
then
5090 call this_agent%neuro_resp( &
5091 this_trait = this%stomach, &
5092 g_p_matrix = here_param_gp_matrix_stomach, &
5093 init_val = this_agent%perceive_stomach%get_available(), &
5094 gerror_cv = here_param_gerror_cv_stomach, &
5095 label = param_gene_label_stomach )
5099 call this_agent%neuro_resp( &
5100 this_trait = this%stomach, &
5101 g_p_matrix = here_param_gp_matrix_stomach, &
5102 init_val = this_agent%perceive_stomach%get_available(), &
5103 gerror_cv = here_param_gerror_cv_stomach )
5107 bodymass:
if (
present(param_gp_matrix_bodymass))
then
5108 here_param_gp_matrix_bodymass = param_gp_matrix_bodymass
5109 if (
present(param_gerror_cv_bodymass))
then
5110 here_param_gerror_cv_bodymass = param_gerror_cv_bodymass
5112 here_param_gerror_cv_bodymass = 0.0_srp
5115 if (
present(param_gene_label_bodymass))
then
5118 call this_agent%neuro_resp( &
5119 this_trait = this%bodymass, &
5120 g_p_matrix = here_param_gp_matrix_bodymass, &
5121 init_val = this_agent%perceive_body_mass%get_current(), &
5122 gerror_cv = here_param_gerror_cv_bodymass, &
5123 label = param_gene_label_bodymass )
5127 call this_agent%neuro_resp( &
5128 this_trait = this%bodymass, &
5129 g_p_matrix = here_param_gp_matrix_bodymass, &
5130 init_val = this_agent%perceive_body_mass%get_current(), &
5131 gerror_cv = here_param_gerror_cv_bodymass )
5135 energy:
if (
present(param_gp_matrix_energy))
then
5136 here_param_gp_matrix_energy = param_gp_matrix_energy
5137 if (
present(param_gerror_cv_energy))
then
5138 here_param_gerror_cv_energy = param_gerror_cv_energy
5140 here_param_gerror_cv_energy = 0.0_srp
5143 if (
present(param_gene_label_energy))
then
5146 call this_agent%neuro_resp( &
5147 this_trait = this%energy, &
5148 g_p_matrix = here_param_gp_matrix_energy, &
5149 init_val = this_agent%perceive_energy%get_current(), &
5150 gerror_cv = here_param_gerror_cv_energy, &
5151 label = param_gene_label_energy )
5155 call this_agent%neuro_resp( &
5156 this_trait = this%energy, &
5157 g_p_matrix = here_param_gp_matrix_energy, &
5158 init_val = this_agent%perceive_energy%get_current(), &
5159 gerror_cv = here_param_gerror_cv_energy )
5163 age:
if (
present(param_gp_matrix_age))
then
5164 here_param_gp_matrix_age = param_gp_matrix_age
5165 if (
present(param_gerror_cv_age))
then
5166 here_param_gerror_cv_age = param_gerror_cv_age
5168 here_param_gerror_cv_age = 0.0_srp
5171 if (
present(param_gene_label_age))
then
5174 call this_agent%neuro_resp( &
5175 this_trait = this%age, &
5176 g_p_matrix = here_param_gp_matrix_age, &
5177 init_val = real(this_agent%perceive_age%get_current(), srp), &
5178 gerror_cv = here_param_gerror_cv_age, &
5179 label = param_gene_label_age )
5183 call this_agent%neuro_resp( &
5184 this_trait = this%age, &
5185 g_p_matrix = here_param_gp_matrix_age, &
5186 init_val = real(this_agent%perceive_age%get_current(), srp), &
5187 gerror_cv = here_param_gerror_cv_age )
5191 reprfac:
if (
present(param_gp_matrix_reprfac))
then
5192 here_param_gp_matrix_reprfac = param_gp_matrix_reprfac
5193 if (
present(param_gerror_cv_reprfac))
then
5194 here_param_gerror_cv_reprfac = param_gerror_cv_reprfac
5196 here_param_gerror_cv_reprfac = 0.0_srp
5199 if (
present(param_gene_label_reprfac))
then
5202 call this_agent%neuro_resp( &
5203 this_trait = this%reprfac, &
5204 g_p_matrix = here_param_gp_matrix_reprfac, &
5205 init_val = this_agent%perceive_reprfac%get_current(), &
5206 gerror_cv = here_param_gerror_cv_reprfac, &
5207 label = param_gene_label_reprfac )
5211 call this_agent%neuro_resp( &
5212 this_trait = this%reprfac, &
5213 g_p_matrix = here_param_gp_matrix_reprfac, &
5214 init_val = this_agent%perceive_reprfac%get_current(), &
5215 gerror_cv = here_param_gerror_cv_reprfac )
5233 ! Boolean G x P matrices:
5234 param_gp_matrix_light, &
5235 param_gp_matrix_depth, &
5236 param_gp_matrix_food_dir, &
5237 param_gp_matrix_food_mem, &
5238 param_gp_matrix_conspec, &
5239 param_gp_matrix_pred_dir, &
5240 param_gp_matrix_predator, &
5241 param_gp_matrix_stomach, &
5242 param_gp_matrix_bodymass, &
5243 param_gp_matrix_energy, &
5244 param_gp_matrix_age, &
5245 param_gp_matrix_reprfac, &
5247 param_gerror_cv_light, &
5248 param_gerror_cv_depth, &
5249 param_gerror_cv_food_dir, &
5250 param_gerror_cv_food_mem, &
5251 param_gerror_cv_conspec, &
5252 param_gerror_cv_pred_dir, &
5253 param_gerror_cv_predator, &
5254 param_gerror_cv_stomach, &
5255 param_gerror_cv_bodymass, &
5256 param_gerror_cv_energy, &
5257 param_gerror_cv_age, &
5258 param_gerror_cv_reprfac, &
5259 ! Override raw perceptions
5260 perception_override_light, &
5261 perception_override_depth, &
5262 perception_override_food_dir, &
5263 perception_override_food_mem, &
5264 perception_override_conspec, &
5265 perception_override_pred_dir, &
5266 perception_override_predator, &
5267 perception_override_stomach, &
5268 perception_override_bodymass, &
5269 perception_override_energy, &
5270 perception_override_age, &
5271 perception_override_reprfac &
5276 class(
appraisal),
intent(in) :: this_agent
5316 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES),
optional,
intent(in) :: &
5317 param_gp_matrix_light, &
5318 param_gp_matrix_depth, &
5319 param_gp_matrix_food_dir, &
5320 param_gp_matrix_food_mem, &
5321 param_gp_matrix_conspec, &
5322 param_gp_matrix_pred_dir, &
5323 param_gp_matrix_predator, &
5324 param_gp_matrix_stomach, &
5325 param_gp_matrix_bodymass, &
5326 param_gp_matrix_energy, &
5327 param_gp_matrix_age, &
5328 param_gp_matrix_reprfac
5361 real(SRP),
optional,
intent(in) :: param_gerror_cv_light, &
5362 param_gerror_cv_depth, &
5363 param_gerror_cv_food_dir, &
5364 param_gerror_cv_food_mem, &
5365 param_gerror_cv_conspec, &
5366 param_gerror_cv_pred_dir, &
5367 param_gerror_cv_predator, &
5368 param_gerror_cv_stomach, &
5369 param_gerror_cv_bodymass, &
5370 param_gerror_cv_energy, &
5371 param_gerror_cv_age, &
5372 param_gerror_cv_reprfac
5411 real(SRP),
optional,
intent(in) :: perception_override_light, &
5412 perception_override_depth, &
5413 perception_override_food_dir, &
5414 perception_override_food_mem, &
5415 perception_override_conspec, &
5416 perception_override_pred_dir, &
5417 perception_override_predator, &
5418 perception_override_stomach, &
5419 perception_override_bodymass, &
5420 perception_override_energy, &
5421 perception_override_age, &
5422 perception_override_reprfac
5428 logical,
dimension(MAX_NALLELES,N_CHROMOSOMES) :: &
5429 here_param_gp_matrix_light, &
5430 here_param_gp_matrix_depth, &
5431 here_param_gp_matrix_food_dir, &
5432 here_param_gp_matrix_food_mem, &
5433 here_param_gp_matrix_conspec, &
5434 here_param_gp_matrix_pred_dir, &
5435 here_param_gp_matrix_predator, &
5436 here_param_gp_matrix_stomach, &
5437 here_param_gp_matrix_bodymass, &
5438 here_param_gp_matrix_energy, &
5439 here_param_gp_matrix_age, &
5440 here_param_gp_matrix_reprfac
5443 real(SRP) :: here_param_gerror_cv_light, &
5444 here_param_gerror_cv_depth, &
5445 here_param_gerror_cv_food_dir, &
5446 here_param_gerror_cv_food_mem, &
5447 here_param_gerror_cv_conspec, &
5448 here_param_gerror_cv_pred_dir, &
5449 here_param_gerror_cv_predator, &
5450 here_param_gerror_cv_stomach, &
5451 here_param_gerror_cv_bodymass, &
5452 here_param_gerror_cv_energy, &
5453 here_param_gerror_cv_age, &
5454 here_param_gerror_cv_reprfac
5466 light:
if (
present(param_gp_matrix_light))
then
5467 here_param_gp_matrix_light = param_gp_matrix_light
5468 if (
present(param_gerror_cv_light))
then
5469 here_param_gerror_cv_light = param_gerror_cv_light
5471 here_param_gerror_cv_light = 0.0_srp
5474 if (
present(perception_override_light))
then
5475 call this_agent%neuro_resp( &
5476 this_trait = this%light, &
5477 g_p_matrix = here_param_gp_matrix_light, &
5478 init_val = perception_override_light, &
5479 gerror_cv = here_param_gerror_cv_light )
5481 call this_agent%neuro_resp( &
5482 this_trait = this%light, &
5483 g_p_matrix = here_param_gp_matrix_light, &
5484 init_val = this_agent%perceive_light%get_current(), &
5485 gerror_cv = here_param_gerror_cv_light )
5489 depth:
if (
present(param_gp_matrix_depth))
then
5490 here_param_gp_matrix_depth = param_gp_matrix_depth
5491 if (
present(param_gerror_cv_depth))
then
5492 here_param_gerror_cv_depth = param_gerror_cv_depth
5494 here_param_gerror_cv_depth = 0.0_srp
5497 if (
present(perception_override_depth))
then
5498 call this_agent%neuro_resp( &
5499 this_trait = this%depth, &
5500 g_p_matrix = here_param_gp_matrix_depth, &
5501 init_val = perception_override_depth, &
5502 gerror_cv = here_param_gerror_cv_depth )
5504 call this_agent%neuro_resp( &
5505 this_trait = this%depth, &
5506 g_p_matrix = here_param_gp_matrix_depth, &
5507 init_val = this_agent%perceive_depth%get_current(), &
5508 gerror_cv = here_param_gerror_cv_depth )
5513 food_dir:
if (
present(param_gp_matrix_food_dir))
then
5514 here_param_gp_matrix_food_dir = param_gp_matrix_food_dir
5515 if (
present(param_gerror_cv_food_dir))
then
5516 here_param_gerror_cv_food_dir = param_gerror_cv_food_dir
5518 here_param_gerror_cv_food_dir = 0.0_srp
5521 if (
present(perception_override_food_dir))
then
5522 call this_agent%neuro_resp( &
5523 this_trait = this%food_dir, &
5524 g_p_matrix = here_param_gp_matrix_food_dir, &
5525 init_val = perception_override_food_dir, &
5526 gerror_cv = here_param_gerror_cv_food_dir )
5528 call this_agent%neuro_resp( &
5529 this_trait = this%food_dir, &
5530 g_p_matrix = here_param_gp_matrix_food_dir, &
5531 init_val = real(this_agent%perceive_food%get_count(), srp), &
5532 gerror_cv = here_param_gerror_cv_food_dir )
5536 food_mem:
if (
present(param_gp_matrix_food_mem))
then
5537 here_param_gp_matrix_food_mem = param_gp_matrix_food_mem
5538 if (
present(param_gerror_cv_food_mem))
then
5539 here_param_gerror_cv_food_mem = param_gerror_cv_food_mem
5541 here_param_gerror_cv_food_mem = 0.0_srp
5544 if (
present(perception_override_food_mem))
then
5545 call this_agent%neuro_resp( &
5546 this_trait = this%food_mem, &
5547 g_p_matrix = here_param_gp_matrix_food_mem, &
5548 init_val = perception_override_food_mem, &
5549 gerror_cv = here_param_gerror_cv_food_mem )
5551 call this_agent%neuro_resp( &
5552 this_trait = this%food_mem, &
5553 g_p_matrix = here_param_gp_matrix_food_mem, &
5554 init_val = this_agent%memory_stack%get_food_mean_n(), &
5555 gerror_cv = here_param_gerror_cv_food_mem )
5559 conspec:
if (
present(param_gp_matrix_conspec))
then
5560 here_param_gp_matrix_conspec = param_gp_matrix_conspec
5561 if (
present(param_gerror_cv_conspec))
then
5562 here_param_gerror_cv_conspec = param_gerror_cv_conspec
5564 here_param_gerror_cv_conspec = 0.0_srp
5567 if (
present(perception_override_conspec))
then
5568 call this_agent%neuro_resp( &
5569 this_trait = this%conspec, &
5570 g_p_matrix = here_param_gp_matrix_conspec, &
5571 init_val = perception_override_conspec, &
5572 gerror_cv = here_param_gerror_cv_conspec )
5574 call this_agent%neuro_resp( &
5575 this_trait = this%conspec, &
5576 g_p_matrix = here_param_gp_matrix_conspec, &
5577 init_val = real(this_agent%perceive_consp%get_count(), srp),&
5578 gerror_cv = here_param_gerror_cv_conspec )
5583 pred_dir:
if (
present(param_gp_matrix_pred_dir))
then
5584 here_param_gp_matrix_pred_dir = param_gp_matrix_pred_dir
5585 if (
present(param_gerror_cv_pred_dir))
then
5586 here_param_gerror_cv_pred_dir = param_gerror_cv_pred_dir
5588 here_param_gerror_cv_pred_dir = 0.0_srp
5591 if (
present(perception_override_pred_dir))
then
5592 call this_agent%neuro_resp( &
5593 this_trait = this%pred_dir, &
5594 g_p_matrix = here_param_gp_matrix_pred_dir, &
5595 init_val = perception_override_pred_dir, &
5596 gerror_cv = here_param_gerror_cv_pred_dir )
5598 call this_agent%neuro_resp( &
5599 this_trait = this%pred_dir, &
5600 g_p_matrix = here_param_gp_matrix_pred_dir, &
5601 init_val = this_agent%risk_pred(), &
5602 gerror_cv = here_param_gerror_cv_pred_dir )
5606 predator:
if (
present(param_gp_matrix_predator))
then
5607 here_param_gp_matrix_predator = param_gp_matrix_predator
5608 if (
present(param_gerror_cv_predator))
then
5609 here_param_gerror_cv_predator = param_gerror_cv_predator
5611 here_param_gerror_cv_predator = 0.0_srp
5614 if (
present(perception_override_predator))
then
5615 call this_agent%neuro_resp( &
5616 this_trait = this%predator, &
5617 g_p_matrix = here_param_gp_matrix_predator, &
5618 init_val = perception_override_predator, &
5619 gerror_cv = here_param_gerror_cv_predator )
5621 call this_agent%neuro_resp( &
5622 this_trait = this%predator, &
5623 g_p_matrix = here_param_gp_matrix_predator, &
5624 init_val = this_agent%predation_risk(), &
5625 gerror_cv = here_param_gerror_cv_predator )
5629 stomach:
if (
present(param_gp_matrix_stomach))
then
5630 here_param_gp_matrix_stomach = param_gp_matrix_stomach
5631 if (
present(param_gerror_cv_stomach))
then
5632 here_param_gerror_cv_stomach = param_gerror_cv_stomach
5634 here_param_gerror_cv_stomach = 0.0_srp
5637 if (
present(perception_override_stomach))
then
5638 call this_agent%neuro_resp( &
5639 this_trait = this%stomach, &
5640 g_p_matrix = here_param_gp_matrix_stomach, &
5641 init_val = perception_override_stomach, &
5642 gerror_cv = here_param_gerror_cv_stomach )
5644 call this_agent%neuro_resp( &
5645 this_trait = this%stomach, &
5646 g_p_matrix = here_param_gp_matrix_stomach, &
5647 init_val = this_agent%perceive_stomach%get_available(), &
5648 gerror_cv = here_param_gerror_cv_stomach )
5652 bodymass:
if (
present(param_gp_matrix_bodymass))
then
5653 here_param_gp_matrix_bodymass = param_gp_matrix_bodymass
5654 if (
present(param_gerror_cv_bodymass))
then
5655 here_param_gerror_cv_bodymass = param_gerror_cv_bodymass
5657 here_param_gerror_cv_bodymass = 0.0_srp
5660 if (
present(perception_override_bodymass))
then
5661 call this_agent%neuro_resp( &
5662 this_trait = this%bodymass, &
5663 g_p_matrix = here_param_gp_matrix_bodymass, &
5664 init_val = perception_override_bodymass, &
5665 gerror_cv = here_param_gerror_cv_bodymass )
5667 call this_agent%neuro_resp( &
5668 this_trait = this%bodymass, &
5669 g_p_matrix = here_param_gp_matrix_bodymass, &
5670 init_val = this_agent%perceive_body_mass%get_current(), &
5671 gerror_cv = here_param_gerror_cv_bodymass )
5675 energy:
if (
present(param_gp_matrix_energy))
then
5676 here_param_gp_matrix_energy = param_gp_matrix_energy
5677 if (
present(param_gerror_cv_energy))
then
5678 here_param_gerror_cv_energy = param_gerror_cv_energy
5680 here_param_gerror_cv_energy = 0.0_srp
5683 if (
present(perception_override_energy))
then
5684 call this_agent%neuro_resp( &
5685 this_trait = this%energy, &
5686 g_p_matrix = here_param_gp_matrix_energy, &
5687 init_val = perception_override_energy, &
5688 gerror_cv = here_param_gerror_cv_energy )
5690 call this_agent%neuro_resp( &
5691 this_trait = this%energy, &
5692 g_p_matrix = here_param_gp_matrix_energy, &
5693 init_val = this_agent%perceive_energy%get_current(), &
5694 gerror_cv = here_param_gerror_cv_energy )
5698 age:
if (
present(param_gp_matrix_age))
then
5699 here_param_gp_matrix_age = param_gp_matrix_age
5700 if (
present(param_gerror_cv_age))
then
5701 here_param_gerror_cv_age = param_gerror_cv_age
5703 here_param_gerror_cv_age = 0.0_srp
5706 if (
present(perception_override_age))
then
5707 call this_agent%neuro_resp( &
5708 this_trait = this%age, &
5709 g_p_matrix = here_param_gp_matrix_age, &
5710 init_val = perception_override_age, &
5711 gerror_cv = here_param_gerror_cv_age )
5713 call this_agent%neuro_resp( &
5714 this_trait = this%age, &
5715 g_p_matrix = here_param_gp_matrix_age, &
5716 init_val = real(this_agent%perceive_age%get_current(), srp),&
5717 gerror_cv = here_param_gerror_cv_age )
5721 reprfac:
if (
present(param_gp_matrix_reprfac))
then
5722 here_param_gp_matrix_reprfac = param_gp_matrix_reprfac
5723 if (
present(param_gerror_cv_reprfac))
then
5724 here_param_gerror_cv_reprfac = param_gerror_cv_reprfac
5726 here_param_gerror_cv_reprfac = 0.0_srp
5730 if (
present(perception_override_reprfac))
then
5731 call this_agent%neuro_resp( &
5732 this_trait = this%reprfac, &
5733 g_p_matrix = here_param_gp_matrix_reprfac, &
5734 init_val = perception_override_reprfac, &
5735 gerror_cv = here_param_gerror_cv_reprfac )
5737 call this_agent%neuro_resp( &
5738 this_trait = this%reprfac, &
5739 g_p_matrix = here_param_gp_matrix_reprfac, &
5740 init_val = this_agent%perceive_reprfac%get_current(), &
5741 gerror_cv = here_param_gerror_cv_reprfac )
5754 real(
srp) :: value_get
5756 value_get = this%percept_component%light
5766 real(
srp) :: value_get
5768 value_get = this%percept_component%depth
5778 real(
srp) :: value_get
5780 value_get = this%percept_component%food_dir
5790 real(
srp) :: value_get
5792 value_get = this%percept_component%food_mem
5802 real(
srp) :: value_get
5804 value_get = this%percept_component%conspec
5814 real(
srp) :: value_get
5816 value_get = this%percept_component%pred_dir
5826 real(
srp) :: value_get
5828 value_get = this%percept_component%predator
5838 real(
srp) :: value_get
5840 value_get = this%percept_component%stomach
5850 real(
srp) :: value_get
5852 value_get = this%percept_component%bodymass
5862 real(
srp) :: value_get
5864 value_get = this%percept_component%energy
5874 real(
srp) :: value_get
5876 value_get = this%percept_component%age
5886 real(
srp) :: value_get
5888 value_get = this%percept_component%reprfac
5898 real(
srp) :: value_get
5900 value_get = this%motivation_prim
5910 real(
srp) :: value_get
5912 value_get = this%motivation_finl
5923 logical :: gos_dominant
5925 gos_dominant = this%dominant_state
5936 character(len=LABEL_LENGTH) :: label_get
5938 label_get = this%label
5954 associate( to_this => this%attention_weight, &
5955 from_this => copy_from%attention_weight )
5956 to_this%light = from_this%light
5957 to_this%depth = from_this%depth
5958 to_this%food_dir = from_this%food_dir
5959 to_this%food_mem = from_this%food_mem
5960 to_this%conspec = from_this%conspec
5961 to_this%pred_dir = from_this%pred_dir
5962 to_this%predator = from_this%predator
5963 to_this%stomach = from_this%stomach
5964 to_this%bodymass = from_this%bodymass
5965 to_this%energy = from_this%energy
5966 to_this%age = from_this%age
5967 to_this%reprfac = from_this%reprfac
5978 real(srp) :: maxvalue
5980 maxvalue = maxval( [ &
6004 real(srp) :: maxvalue
6006 maxvalue = this%percept_component%max_value()
6015 result(motivation_prim)
6021 real(srp),
optional,
intent(in) :: maxvalue
6025 real(srp) :: motivation_prim
6028 real(srp),
parameter :: p0 = 0.0_srp, p1 = 1.0_srp
6031 real(srp) :: maxvalue_here
6033 check_max_optnl:
if (
present(maxvalue))
then
6034 maxvalue_here = maxvalue
6035 else check_max_optnl
6044 maxvalue_here = this%max_perception()
6045 end if check_max_optnl
6054 motivation_prim = average( [ &
6055 rescale(this%percept_component%light, p0, maxvalue_here, p0, p1) * &
6056 this%attention_weight%light, &
6058 rescale(this%percept_component%depth, p0, maxvalue_here, p0, p1) * &
6059 this%attention_weight%depth, &
6061 rescale(this%percept_component%food_dir, p0, maxvalue_here, p0, p1) * &
6062 this%attention_weight%food_dir, &
6064 rescale(this%percept_component%food_mem, p0, maxvalue_here, p0, p1) * &
6065 this%attention_weight%food_mem, &
6067 rescale(this%percept_component%conspec, p0, maxvalue_here, p0, p1) * &
6068 this%attention_weight%conspec, &
6070 rescale(this%percept_component%pred_dir, p0, maxvalue_here, p0, p1) * &
6071 this%attention_weight%pred_dir, &
6073 rescale(this%percept_component%predator, p0, maxvalue_here, p0, p1) * &
6074 this%attention_weight%predator, &
6076 rescale(this%percept_component%stomach, p0, maxvalue_here, p0, p1) * &
6077 this%attention_weight%stomach, &
6079 rescale(this%percept_component%bodymass, p0, maxvalue_here, p0, p1) * &
6080 this%attention_weight%bodymass, &
6082 rescale(this%percept_component%energy, p0, maxvalue_here, p0, p1) * &
6083 this%attention_weight%energy, &
6085 rescale(this%percept_component%age, p0, maxvalue_here, p0, p1) * &
6086 this%attention_weight%age, &
6088 rescale(this%percept_component%reprfac, p0, maxvalue_here, p0, p1) * &
6089 this%attention_weight%reprfac ] )
6100 this%light = missing
6101 this%depth = missing
6102 this%food_dir = missing
6103 this%food_mem = missing
6104 this%conspec = missing
6105 this%pred_dir = missing
6106 this%predator = missing
6107 this%stomach = missing
6108 this%bodymass = missing
6109 this%energy = missing
6111 this%reprfac = missing
6121 this%label =
"HUNGER"
6123 call this%percept_component%init()
6125 call this%attention_weight%attention_init( &
6126 weight_light = attention_switch_hunger_light, &
6127 weight_depth = attention_switch_hunger_depth, &
6128 weight_food_dir = attention_switch_hunger_food_dir, &
6129 weight_food_mem = attention_switch_hunger_food_mem, &
6130 weight_conspec = attention_switch_hunger_conspec, &
6131 weight_pred_dir = attention_switch_hunger_pred_dir, &
6132 weight_predator = attention_switch_hunger_predator, &
6133 weight_stomach = attention_switch_hunger_stomach, &
6134 weight_bodymass = attention_switch_hunger_bodymass, &
6135 weight_energy = attention_switch_hunger_energy, &
6136 weight_age = attention_switch_hunger_age, &
6137 weight_reprfac = attention_switch_hunger_reprfac )
6139 this%motivation_prim = missing
6140 this%motivation_finl = missing
6142 this%dominant_state = .false.
6153 this%label =
"ACTIVE_AVOID"
6155 call this%percept_component%init()
6157 call this%attention_weight%attention_init( &
6158 weight_light = attention_switch_avoid_act_light, &
6159 weight_depth = attention_switch_avoid_act_depth, &
6160 weight_food_dir = attention_switch_avoid_act_food_dir, &
6161 weight_food_mem = attention_switch_avoid_act_food_mem, &
6162 weight_conspec = attention_switch_avoid_act_conspec, &
6163 weight_pred_dir = attention_switch_avoid_act_pred_dir, &
6164 weight_predator = attention_switch_avoid_act_predator, &
6165 weight_stomach = attention_switch_avoid_act_stomach, &
6166 weight_bodymass = attention_switch_avoid_act_bodymass, &
6167 weight_energy = attention_switch_avoid_act_energy, &
6168 weight_age = attention_switch_avoid_act_age, &
6169 weight_reprfac = attention_switch_avoid_act_reprfac )
6171 this%motivation_prim = missing
6172 this%motivation_finl = missing
6174 this%dominant_state = .false.
6185 this%label =
"REPRODUCTION"
6187 call this%percept_component%init()
6189 call this%attention_weight%attention_init( &
6190 weight_light = attention_switch_reproduce_light, &
6191 weight_depth = attention_switch_reproduce_depth, &
6192 weight_food_dir = attention_switch_reproduce_food_dir, &
6193 weight_food_mem = attention_switch_reproduce_food_mem, &
6194 weight_conspec = attention_switch_reproduce_conspec, &
6195 weight_pred_dir = attention_switch_reproduce_pred_dir, &
6196 weight_predator = attention_switch_reproduce_predator, &
6197 weight_stomach = attention_switch_reproduce_stomach, &
6198 weight_bodymass = attention_switch_reproduce_bodymass, &
6199 weight_energy = attention_switch_reproduce_energy, &
6200 weight_age = attention_switch_reproduce_age, &
6201 weight_reprfac = attention_switch_reproduce_reprfac )
6203 this%motivation_prim = missing
6204 this%motivation_finl = missing
6206 this%dominant_state = .false.
6216 call this%hunger%clean_init()
6217 call this%fear_defence%clean_init()
6218 call this%reproduction%clean_init()
6222 this%number_of_states = 3
6232 this%hunger%dominant_state = .false.
6233 this%fear_defence%dominant_state = .false.
6234 this%reproduction%dominant_state = .false.
6242 result(max_motivation)
6247 real(srp) :: max_motivation
6249 max_motivation = maxval([ this%hunger%max_perception(), &
6250 this%fear_defence%max_perception(), &
6251 this%reproduction%max_perception() ])
6259 result(final_vals_vector)
6261 real(srp),
allocatable,
dimension(:) :: final_vals_vector
6263 final_vals_vector = [ this%hunger%motivation_finl, &
6264 this%fear_defence%motivation_finl, &
6265 this%reproduction%motivation_finl ]
6275 real(srp) :: maxvalue
6280 maxvalue = maxval( this%finals() )
6289 this, test_value)
result(is_maximum)
6291 real(srp),
intent(in) :: test_value
6292 logical :: is_maximum
6299 if ( is_maxval( test_value, this%finals() ) ) is_maximum = .true.
6308 this, test_motivation)
result(is_maximum)
6311 logical :: is_maximum
6313 is_maximum = .false.
6315 if ( is_maxval( test_motivation%motivation_value(), this%finals() ) ) &
6335 real(srp),
optional,
intent(in) :: max_val
6340 real(srp) :: appmaxval
6347 if (
present(max_val))
then
6356 appmaxval = this%max_perception()
6367 this%hunger%motivation_prim = &
6368 this%hunger%motivation_calculate(appmaxval)
6370 this%fear_defence%motivation_prim = &
6371 this%fear_defence%motivation_calculate(appmaxval)
6373 this%reproduction%motivation_prim = &
6374 this%reproduction%motivation_calculate(appmaxval)
6387 this%hunger%motivation_finl = &
6388 this%hunger%motivation_prim
6390 this%fear_defence%motivation_finl = &
6391 this%fear_defence%motivation_prim
6393 this%reproduction%motivation_finl = &
6394 this%reproduction%motivation_prim
6450 call this%motivations%init()
6453 call this%memory_motivations%memory_cleanup()
6478 call this%set_dead()
6479 call this%init_reproduction()
6480 call this%init_perception()
6481 call this%init_appraisal()
6505 call this%motivations%hunger%percept_component%motivation_components_init &
6508 param_gp_matrix_light = light_hunger_genotype_neuronal, &
6509 param_gp_matrix_depth = depth_hunger_genotype_neuronal, &
6510 param_gp_matrix_food_dir = foodcount_hunger_genotype_neuronal, &
6511 param_gp_matrix_food_mem = food_mem_hunger_genotype_neuronal, &
6512 param_gp_matrix_conspec = conspcount_hunger_genotype_neuronal, &
6513 param_gp_matrix_pred_dir = pred_direct_hunger_genotype_neuronal, &
6514 param_gp_matrix_predator = pred_meancount_hunger_genotype_neuronal, &
6515 param_gp_matrix_stomach = stom_hunger_genotype_neuronal, &
6516 param_gp_matrix_bodymass = bodymass_hunger_genotype_neuronal, &
6517 param_gp_matrix_energy = energy_hunger_genotype_neuronal, &
6518 param_gp_matrix_age = age_hunger_genotype_neuronal, &
6519 param_gp_matrix_reprfac = reprfac_hunger_genotype_neuronal, &
6521 param_gerror_cv_light = light_hunger_genotype_neuronal_gerror_cv, &
6522 param_gerror_cv_depth = depth_hunger_genotype_neuronal_gerror_cv, &
6523 param_gerror_cv_food_dir = foodcount_hunger_genotype_neuronal_gerror_cv,&
6524 param_gerror_cv_food_mem = food_mem_hunger_genotype_neuronal_gerror_cv, &
6525 param_gerror_cv_conspec = conspcount_hunger_genotype_neuronal_gerror_cv,&
6526 param_gerror_cv_pred_dir = pred_direct_hunger_genotype_neuronal_gerror_cv,&
6527 param_gerror_cv_predator = pred_meancount_hunger_genotype_neuronal_gerror_cv,&
6528 param_gerror_cv_stomach = stom_hunger_genotype_neuronal_gerror_cv, &
6529 param_gerror_cv_bodymass = bodymass_hunger_genotype_neuronal_gerror_cv, &
6530 param_gerror_cv_energy = energy_hunger_genotype_neuronal_gerror_cv, &
6531 param_gerror_cv_age = age_hunger_genotype_neuronal_gerror_cv, &
6532 param_gerror_cv_reprfac = reprfac_hunger_genotype_neuronal_gerror_cv, &
6534 param_gene_label_light =
"HUNGER_LIGHT", &
6535 param_gene_label_depth =
"HUNGER_DEPTH", &
6536 param_gene_label_food_dir=
"HUNGER_FOODMEM", &
6537 param_gene_label_food_mem=
"HUNGER_FOODMEM", &
6538 param_gene_label_conspec =
"HUNGER_CONSP_N", &
6539 param_gene_label_pred_dir=
"HUNGER_PREDDIR", &
6540 param_gene_label_predator=
"HUNGER_PRED", &
6541 param_gene_label_stomach =
"HUNGER_STOM", &
6542 param_gene_label_bodymass=
"HUNGER_BODYMAS", &
6543 param_gene_label_energy =
"HUNGER_ENERGY", &
6544 param_gene_label_age =
"HUNGER_AGE", &
6545 param_gene_label_reprfac =
"HUNGER_REPRFAC" )
6550 call this%motivations%fear_defence%percept_component%motivation_components_init &
6553 param_gp_matrix_light = light_actv_avoid_genotype_neuronal, &
6554 param_gp_matrix_depth = depth_actv_avoid_genotype_neuronal, &
6555 param_gp_matrix_food_dir = foodcount_actv_avoid_genotype_neuronal, &
6556 param_gp_matrix_food_mem = food_mem_actv_avoid_genotype_neuronal, &
6557 param_gp_matrix_conspec = conspcount_actv_avoid_genotype_neuronal, &
6558 param_gp_matrix_pred_dir = pred_direct_actv_avoid_genotype_neuronal, &
6559 param_gp_matrix_predator = pred_meancount_actv_avoid_genotype_neuronal, &
6560 param_gp_matrix_stomach = stom_actv_avoid_genotype_neuronal, &
6561 param_gp_matrix_bodymass = bodymass_actv_avoid_genotype_neuronal, &
6562 param_gp_matrix_energy = energy_actv_avoid_genotype_neuronal, &
6563 param_gp_matrix_age = age_actv_avoid_genotype_neuronal, &
6564 param_gp_matrix_reprfac = reprfac_actv_avoid_genotype_neuronal, &
6566 param_gerror_cv_light = light_actv_avoid_genotype_neuronal_gerror_cv, &
6567 param_gerror_cv_depth = depth_actv_avoid_genotype_neuronal_gerror_cv, &
6568 param_gerror_cv_food_dir = foodcount_actv_avoid_genotype_neuronal_gerror_cv,&
6569 param_gerror_cv_food_mem = food_mem_actv_avoid_genotype_neuronal_gerror_cv, &
6570 param_gerror_cv_conspec = conspcount_actv_avoid_genotype_neuronal_gerror_cv,&
6571 param_gerror_cv_pred_dir = pred_direct_actv_avoid_genotype_neuronal_gerror_cv,&
6572 param_gerror_cv_predator = pred_meancount_actv_avoid_genotype_neuronal_gerror_cv,&
6573 param_gerror_cv_stomach = stom_actv_avoid_genotype_neuronal_gerror_cv, &
6574 param_gerror_cv_bodymass = bodymass_actv_avoid_genotype_neuronal_gerror_cv,&
6575 param_gerror_cv_energy = energy_actv_avoid_genotype_neuronal_gerror_cv,&
6576 param_gerror_cv_age = age_actv_avoid_genotype_neuronal_gerror_cv, &
6577 param_gerror_cv_reprfac = reprfac_actv_avoid_genotype_neuronal_gerror_cv,&
6579 param_gene_label_light =
"AAVOID_LIGHT", &
6580 param_gene_label_depth =
"AAVOID_DEPTH", &
6581 param_gene_label_food_dir=
"AAVOID_FOODMEM", &
6582 param_gene_label_food_mem=
"AAVOID_FOODMEM", &
6583 param_gene_label_conspec =
"AAVOID_CONSP_N", &
6584 param_gene_label_pred_dir=
"AAVOID_PREDDIR", &
6585 param_gene_label_predator=
"AAVOID_PRED", &
6586 param_gene_label_stomach =
"AAVOID_STOM", &
6587 param_gene_label_bodymass=
"AAVOID_BODYMAS", &
6588 param_gene_label_energy =
"AAVOID_ENERGY", &
6589 param_gene_label_age =
"AAVOID_AGE", &
6590 param_gene_label_reprfac =
"AAVOID_REPRFAC" )
6595 call this%motivations%reproduction%percept_component%motivation_components_init &
6598 param_gp_matrix_light = light_reproduce_genotype_neuronal, &
6599 param_gp_matrix_depth = depth_reproduce_genotype_neuronal, &
6600 param_gp_matrix_food_dir = foodcount_reproduce_genotype_neuronal, &
6601 param_gp_matrix_food_mem = food_mem_reproduce_genotype_neuronal, &
6602 param_gp_matrix_conspec = conspcount_reproduce_genotype_neuronal, &
6603 param_gp_matrix_pred_dir = pred_direct_reproduce_genotype_neuronal, &
6604 param_gp_matrix_predator = pred_meancount_reproduce_genotype_neuronal, &
6605 param_gp_matrix_stomach = stom_reproduce_genotype_neuronal, &
6606 param_gp_matrix_bodymass = bodymass_reproduce_genotype_neuronal, &
6607 param_gp_matrix_energy = energy_reproduce_genotype_neuronal, &
6608 param_gp_matrix_age = age_reproduce_genotype_neuronal, &
6609 param_gp_matrix_reprfac = reprfac_reproduce_genotype_neuronal, &
6611 param_gerror_cv_light = light_reproduce_genotype_neuronal_gerror_cv, &
6612 param_gerror_cv_depth = depth_reproduce_genotype_neuronal_gerror_cv, &
6613 param_gerror_cv_food_dir = foodcount_reproduce_genotype_neuronal_gerror_cv,&
6614 param_gerror_cv_food_mem = food_mem_reproduce_genotype_neuronal_gerror_cv, &
6615 param_gerror_cv_conspec = conspcount_reproduce_genotype_neuronal_gerror_cv,&
6616 param_gerror_cv_pred_dir = pred_direct_reproduce_genotype_neuronal_gerror_cv,&
6617 param_gerror_cv_predator = pred_meancount_reproduce_genotype_neuronal_gerror_cv,&
6618 param_gerror_cv_stomach = stom_reproduce_genotype_neuronal_gerror_cv, &
6619 param_gerror_cv_bodymass = bodymass_reproduce_genotype_neuronal_gerror_cv,&
6620 param_gerror_cv_energy = energy_reproduce_genotype_neuronal_gerror_cv,&
6621 param_gerror_cv_age = age_reproduce_genotype_neuronal_gerror_cv, &
6622 param_gerror_cv_reprfac = reprfac_reproduce_genotype_neuronal_gerror_cv,&
6624 param_gene_label_light =
"REPROD_LIGHT", &
6625 param_gene_label_depth =
"REPROD_DEPTH", &
6626 param_gene_label_food_dir=
"REPROD_FOODMEM", &
6627 param_gene_label_food_mem=
"REPROD_FOODMEM", &
6628 param_gene_label_conspec =
"REPROD_CONSP_N", &
6629 param_gene_label_pred_dir=
"REPROD_PREDDIR", &
6630 param_gene_label_predator=
"REPROD_PRED", &
6631 param_gene_label_stomach =
"REPROD_STOM", &
6632 param_gene_label_bodymass=
"REPROD_BODYMAS", &
6633 param_gene_label_energy =
"REPROD_ENERGY", &
6634 param_gene_label_age =
"REPROD_AGE", &
6635 param_gene_label_reprfac =
"REPROD_REPRFAC" )
6643 rescale_max_motivation)
6650 real(srp),
optional,
intent(in) :: rescale_max_motivation
6653 real(srp) :: max_motivation
6659 if (
present(rescale_max_motivation))
then
6662 max_motivation = rescale_max_motivation
6667 max_motivation = this%motivations%max_perception()
6672 call this%motivations%motivation_primary_calc(max_motivation)
6691 logical,
optional,
intent(in) :: no_modulation
6694 character(len=*),
parameter :: &
6695 PROCNAME =
"(appraisal_motivation_modulation_non_genetic)"
6697 real(SRP) :: weight_reprfac
6703 real(SRP),
parameter,
dimension(*) :: AGE_ARRAY_ABSCISSA = &
6704 reprod_modulation_devel_abscissa
6713 real(SRP),
parameter,
dimension(*) :: AGE_ARRAY_ORDINATE = &
6714 [ zero, reprod_modulation_devel_w2, 1.0_srp ]
6719 call this%motivations%modulation_none()
6723 if ( modulation_appraisal_disable_all )
return
6727 if (
present(no_modulation))
then
6728 if ( no_modulation )
return
6752 = within( ddpinterpol( age_array_abscissa, age_array_ordinate, &
6753 real(this%get_age(), SRP) ), &
6762 call debug_interpolate_plot_save( &
6763 grid_xx=age_array_abscissa, grid_yy=age_array_ordinate, &
6764 ipol_value=weight_reprfac, &
6765 algstr=
"DDPINTERPOL", &
6766 output_file=
"plot_debug_reproduction_modulal_ageweight_" // &
6767 tostr(global_time_step_model_current) // &
6768 mmdd //
"_a_"// trim(this%individ_label()) //
"_" // &
6769 rand_string(label_length, label_cst,label_cen) // ps )
6771 this%motivations%reproduction%motivation_finl = &
6772 this%motivations%reproduction%motivation_prim * weight_reprfac
6785 no_genetic_modulation)
6791 logical,
optional,
intent(in) :: no_genetic_modulation
6795 real(SRP) :: modulation_gamma
6798 character(len=*),
parameter :: PROCNAME = &
6799 "(appraisal_motivation_modulation_genetic)"
6804 call this%motivations%modulation_none()
6808 if ( modulation_appraisal_disable_all )
return
6812 if (
present(no_genetic_modulation))
then
6813 if ( no_genetic_modulation )
return
6831 call this%trait_init( &
6832 this_trait = modulation_gamma, &
6833 g_p_matrix = sex_male_modulation_reproduce_genotype, &
6834 init_val = this%motivations%reproduction%motivation_prim, &
6835 gerror_cv = sex_male_modulation_reproduce_gerror_cv, &
6836 label =
"M_MALE_REPRO" )
6845 if ( this%is_male() )
then
6846 this%motivations%reproduction%motivation_finl = &
6847 this%motivations%reproduction%motivation_prim + &
6848 this%motivations%reproduction%motivation_prim * &
6849 asymptotic(this%motivations%reproduction%motivation_prim, &
6853 end block male_reprod
6858 female_reprod: block
6863 call this%trait_init( &
6864 this_trait = modulation_gamma, &
6865 g_p_matrix = sex_female_modulation_reproduce_genotype, &
6866 init_val = this%motivations%reproduction%motivation_prim, &
6867 gerror_cv = sex_female_modulation_reproduce_gerror_cv, &
6868 label =
"M_FEMALE_REPRO" )
6877 if ( this%is_female() )
then
6878 this%motivations%reproduction%motivation_finl = &
6879 this%motivations%reproduction%motivation_prim + &
6880 this%motivations%reproduction%motivation_prim * &
6881 asymptotic(this%motivations%reproduction%motivation_prim, &
6885 end block female_reprod
6888 call log_dbg( ltag_info //
"Modulation REPRODUCTION " // &
6889 "gamma: " // tostr(modulation_gamma) // &
6891 tostr(this%motivations%reproduction%motivation_prim) // &
6893 tostr(this%motivations%reproduction%motivation_finl), &
6907 elemental function asymptotic(max_level, x)
result (out_value)
6909 real(srp) :: out_value
6910 real(srp),
intent(in) :: max_level, x
6913 if (max_level <= zero)
then
6921 out_value = (max_level * x) / (1 + x)
6935 call this%memory_motivations%add_to_memory( &
6936 this%motivations%hunger%motivation_finl, &
6937 this%motivations%fear_defence%motivation_finl, &
6938 this%motivations%reproduction%motivation_finl )
6949 allow_immature )
result (p_reproduction)
6954 real(srp),
optional,
intent(in) :: weight_baseline
6964 logical,
optional,
intent(in) :: allow_immature
6966 real(srp) :: p_reproduction
6969 real(srp) :: weight_baseline_here
6970 logical :: allow_immature_loc
6973 character(len=*),
parameter :: &
6974 procname =
"(reproduce_do_probability_reproduction_calc)"
6981 integer :: n_conspecifics_perception
6982 integer :: n_same_sex_perception, n_opposite_sex_perception
6985 real(srp) :: p_reproduction_baseline
6988 real(srp) :: delta_mass
6991 real(srp) :: sum_mass_samesex
6998 if (
present(allow_immature))
then
6999 allow_immature_loc = allow_immature
7001 allow_immature_loc = .false.
7007 check_mature:
if ( .not. allow_immature_loc )
then
7008 if ( .not. this%is_ready_reproduce() )
then
7009 p_reproduction = 0.0
7011 call log_dbg( ltag_info //
"Not ready to reproduce (steroids).", &
7020 check_is_alone:
if ( .NOT. this%has_consp() )
then
7021 p_reproduction = 0.0_srp
7023 call log_dbg( ltag_info //
"No conspecifics in perception", &
7026 end if check_is_alone
7029 if (
present(weight_baseline))
then
7030 weight_baseline_here = weight_baseline
7032 weight_baseline_here = probability_reproduction_base_factor
7037 n_conspecifics_perception = this%perceive_consp%get_count()
7042 n_same_sex_perception = 0
7043 n_opposite_sex_perception = 0
7044 sum_mass_samesex = 0.0_srp
7049 check_sex:
if ( this%is_male() )
then
7050 do concurrent(i=1:n_conspecifics_perception)
7051 if ( this%perceive_consp%conspecifics_seen(i)%is_male() )
then
7052 n_same_sex_perception = n_same_sex_perception + 1
7053 sum_mass_samesex = sum_mass_samesex + &
7054 this%perceive_consp%conspecifics_seen(i)%get_mass()
7056 n_opposite_sex_perception = n_opposite_sex_perception + 1
7060 do concurrent(i=1:n_conspecifics_perception)
7061 if ( this%perceive_consp%conspecifics_seen(i)%is_female() )
then
7062 n_same_sex_perception = n_same_sex_perception + 1
7063 sum_mass_samesex = sum_mass_samesex + &
7064 this%perceive_consp%conspecifics_seen(i)%get_mass()
7066 n_opposite_sex_perception = n_opposite_sex_perception + 1
7073 if (n_opposite_sex_perception == 0)
then
7074 p_reproduction = 0.0_srp
7076 call log_dbg(ltag_info //
" No oposite-sex conspecifics in " // &
7077 "perception, return zero probability.", procname,
modname)
7097 p_reproduction_baseline = &
7098 within( real(n_opposite_sex_perception, srp) / &
7099 (1.0_srp + real(n_same_sex_perception, srp)), &
7100 0.0_srp, 1.0_srp ) * weight_baseline_here
7118 check_calcp:
if (n_same_sex_perception == 0)
then
7124 p_reproduction = p_reproduction_baseline
7126 call log_dbg(ltag_info //
" No same-sex conspecifics in " // &
7127 "perception, return baseline: " // &
7128 tostr(p_reproduction), procname,
modname)
7131 within( this%get_mass() / &
7132 (sum_mass_samesex / real(n_same_sex_perception, srp)), &
7133 minval(probability_reproduction_delta_mass_abscissa), &
7134 maxval(probability_reproduction_delta_mass_abscissa) &
7148 p_reproduction_baseline * &
7149 ddpinterpol(probability_reproduction_delta_mass_abscissa, &
7150 probability_reproduction_delta_mass_ordinate, &
7152 0.0_srp, weight_baseline_here )
7154 call log_dbg(ltag_info // &
7155 " P reproduction: " // tostr(p_reproduction) // &
7156 ", average mass ratio of same sex " // &
7157 "conspecifics in percept: " // tostr(delta_mass) // &
7158 ", N of same-sex conspecifics: " // &
7159 tostr(n_same_sex_perception) // &
7160 ", N of opposite-sex conspecifics: " // &
7161 tostr(n_opposite_sex_perception) // &
7162 ", baseline P reproduction: " // &
7163 tostr(p_reproduction_baseline), procname,
modname)
7171 call debug_interpolate_plot_save( &
7172 grid_xx=probability_reproduction_delta_mass_abscissa, &
7173 grid_yy=probability_reproduction_delta_mass_ordinate, &
7174 ipol_value=delta_mass, &
7175 algstr=
"DDPINTERPOL", &
7176 output_file=
"plot_debug_reproduction_probability_" // &
7177 tostr(global_time_step_model_current) // &
7178 mmdd //
"_a_"// trim(this%individ_label()) //
"_" // &
7179 rand_string(label_length, label_cst,label_cen) // ps )
7195 real(srp),
optional,
intent(in) :: prob
7200 real(srp) :: prob_here
7203 character(len=*),
parameter :: procname=
"(reproduction_success_stochast)"
7211 if (
present(prob))
then
7214 prob_here = this%probability_reproduction()
7219 if ( rand_r4() < prob_here ) success = .true.
7226 v_hunger, v_defence_fear, v_reproduction, &
7227 v_gos_label, v_gos_arousal, v_gos_repeated )
7239 real(srp),
intent(in) :: v_hunger
7240 real(srp),
intent(in) :: v_defence_fear
7241 real(srp),
intent(in) :: v_reproduction
7242 character(*),
optional,
intent(in) :: v_gos_label
7243 real(srp),
optional,
intent(in) :: v_gos_arousal
7244 integer,
optional,
intent(in) :: v_gos_repeated
7252 call add_to_history( this%hunger, v_hunger )
7253 call add_to_history( this%defence_fear, v_defence_fear )
7254 call add_to_history( this%reproduction, v_reproduction )
7261 if (
present(v_gos_label)) &
7262 call add_to_history( this%gos_main, v_gos_label )
7263 if (
present(v_gos_arousal)) &
7264 call add_to_history( this%gos_arousal, v_gos_arousal )
7265 if (
present(v_gos_repeated)) &
7266 call add_to_history( this%gos_repeated, v_gos_repeated )
7274 v_gos_arousal, v_gos_repeated )
7277 character(*),
optional,
intent(in) :: v_gos_label
7280 real(srp),
optional,
intent(in) :: v_gos_arousal
7282 integer,
optional,
intent(in) :: v_gos_repeated
7286 if (
present(v_gos_label))
call add_to_history( this%gos_main, v_gos_label )
7289 if (
present(v_gos_arousal)) &
7290 call add_to_history( this%gos_arousal, v_gos_arousal )
7293 if (
present(v_gos_repeated)) &
7294 call add_to_history( this%gos_repeated, v_gos_repeated )
7306 this%hunger = missing
7307 this%defence_fear = missing
7308 this%reproduction = missing
7310 this%gos_arousal = missing
7311 this%gos_repeated = unknown
7322 real(srp) :: mean_value
7325 integer,
optional,
intent(in) :: last
7328 integer :: last_here
7332 integer,
parameter :: hist_size = size(this%hunger)
7338 if (
present(last))
then
7339 if ( last < hist_size )
then
7342 last_here = hist_size
7345 last_here = hist_size
7351 mean_value = average( this%hunger( hist_size-last_here+1:hist_size ), &
7352 undef_ret_null=.true. )
7363 real(srp) :: mean_value
7366 integer,
optional,
intent(in) :: last
7369 integer :: last_here
7373 integer,
parameter :: hist_size = size(this%defence_fear)
7379 if (
present(last))
then
7380 if ( last < hist_size )
then
7383 last_here = hist_size
7386 last_here = hist_size
7392 mean_value = average( &
7393 this%defence_fear( hist_size-last_here+1:hist_size ), &
7394 undef_ret_null=.true. )
7405 real(srp) :: mean_value
7408 integer,
optional,
intent(in) :: last
7411 integer :: last_here
7415 integer,
parameter :: hist_size = size(this%reproduction)
7421 if (
present(last))
then
7422 if ( last < hist_size )
then
7425 last_here = hist_size
7428 last_here = hist_size
7434 mean_value = average( &
7435 this%reproduction( hist_size-last_here+1:hist_size ), &
7436 undef_ret_null=.true. )
7447 real(srp) :: mean_value
7450 integer,
optional,
intent(in) :: last
7453 integer :: last_here
7457 integer,
parameter :: hist_size = size(this%gos_arousal)
7463 if (
present(last))
then
7464 if ( last < hist_size )
then
7467 last_here = hist_size
7470 last_here = hist_size
7476 mean_value = average( &
7477 this%gos_arousal( hist_size-last_here+1:hist_size ), &
7478 undef_ret_null=.true. )
7524 real(SRP) :: arousal_new
7531 real(SRP) :: gos_dthreshold
7534 character(len=*),
parameter :: PROCNAME =
"(gos_find_global_state)"
7539 arousal_new = this%motivations%max_final()
7541 call log_dbg( ltag_info //
"Current GOS arousal: " // &
7542 tostr(this%gos_arousal), procname,
modname )
7543 call log_dbg( ltag_info //
"Motivations (final) array: " // &
7544 tostr([ this%motivations%hunger%motivation_finl, &
7545 this%motivations%fear_defence%motivation_finl, &
7546 this%motivations%reproduction%motivation_finl ]), &
7548 call log_dbg( ltag_info //
"Arousal max (compet): " // tostr(arousal_new),&
7585 gos_dthreshold = ddpinterpol( motivation_compet_threshold_curve_abscissa, &
7586 motivation_compet_threshold_curve_ordinate, &
7589 call log_dbg( ltag_info //
"GOS threshold from interpolation: " // &
7590 tostr(gos_dthreshold), procname,
modname )
7597 call debug_interpolate_plot_save( &
7598 grid_xx=motivation_compet_threshold_curve_abscissa, &
7599 grid_yy=motivation_compet_threshold_curve_ordinate, &
7600 ipol_value=this%gos_arousal, algstr=
"DDPINTERPOL", &
7601 output_file=
"plot_debug_arousal_gos_threshold_" // &
7602 tostr(global_time_step_model_current) // &
7603 mmdd //
"_a_"// trim(this%individ_label()) // &
7604 "_" // rand_string(label_length, label_cst,label_cen) &
7612 arousal_threshold:
if (arousal_new - this%gos_arousal < &
7613 gos_dthreshold * this%gos_arousal)
then
7621 this%gos_repeated = this%gos_repeated + 1
7633 this%gos_arousal = this%gos_arousal * &
7635 call log_dbg( ltag_info //
"Threshold not exceeded, " // &
7636 "GOS repeated incremented to: " // &
7637 tostr(this%gos_repeated), procname,
modname )
7638 else arousal_threshold
7646 associate( mot => this%motivations )
7648 gos_is_max:
if (mot%is_max_final(mot%hunger))
then
7650 call this%gos_reset()
7652 mot%hunger%dominant_state = .true.
7653 this%gos_main = mot%hunger%label
7654 this%gos_arousal = mot%hunger%motivation_finl
7656 else if (mot%is_max_final(mot%fear_defence))
then gos_is_max
7658 call this%gos_reset()
7660 mot%fear_defence%dominant_state = .true.
7661 this%gos_main = mot%fear_defence%label
7662 this%gos_arousal = mot%fear_defence%motivation_finl
7664 else if (mot%is_max_final(mot%reproduction))
then gos_is_max
7666 call this%gos_reset()
7668 mot%reproduction%dominant_state = .true.
7669 this%gos_main = mot%reproduction%label
7670 this%gos_arousal = mot%reproduction%motivation_finl
7673 call log_dbg( ltag_info //
"Threshold exceeded, arousal: " // &
7674 tostr(this%gos_arousal) //
", label: " // &
7675 this%gos_main, procname,
modname )
7676 end if arousal_threshold
7690 call add_to_history(this%memory_motivations%gos_main, this%gos_main)
7691 call add_to_history(this%memory_motivations%gos_arousal, this%gos_arousal)
7692 call add_to_history(this%memory_motivations%gos_repeated, this%gos_repeated)
7699 call this%attention_modulate()
7710 result(arousal_factor)
7717 integer,
optional,
intent(in) :: time_step
7719 real(srp) :: arousal_factor
7724 arousal_factor = arousal_gos_dissipation_factor
7752 result(arousal_factor)
7754 integer,
intent(in) :: time_step
7758 real(srp) :: arousal_factor
7760 arousal_factor = ddpinterpol( &
7761 arousal_gos_dissipation_nonpar_abscissa, &
7762 arousal_gos_dissipation_nonpar_ordinate, &
7763 real(time_step, srp) )
7770 call debug_interpolate_plot_save( &
7771 grid_xx=arousal_gos_dissipation_nonpar_abscissa, &
7772 grid_yy=arousal_gos_dissipation_nonpar_ordinate, &
7773 ipol_value=real(time_step, srp), algstr=
"DDPINTERPOL", &
7774 output_file=
"plot_debug_arousal_dissipation_factor_" // &
7775 tostr(global_time_step_model_current) // &
7776 mmdd //
"_a_"// trim(this%individ_label()) //
"_" // &
7777 rand_string(label_length, label_cst,label_cen) // ps )
7788 this%gos_main =
"undefined"
7793 this%gos_arousal = missing
7794 this%gos_repeated = unknown
7819 call this%set_dead()
7820 call this%init_reproduction()
7821 call this%init_perception()
7822 call this%init_appraisal()
7823 call this%init_gos()
7836 call this%motivations%gos_ind_reset()
7839 this%gos_repeated = 1
7849 character(len=LABEL_LENGTH) :: return_gos
7866 if (this%motivations%hunger%dominant_state)
then
7867 return_gos = this%motivations%hunger%label
7868 else if (this%motivations%fear_defence%dominant_state)
then
7869 return_gos = this%motivations%fear_defence%label
7870 else if (this%motivations%reproduction%dominant_state)
then
7871 return_gos = this%motivations%reproduction%label
7884 real(srp) :: arousal_out
7887 arousal_out = this%gos_arousal
7903 real(SRP) :: percept_w
7937 percept_w = ddpinterpol( attention_modulation_curve_abscissa, &
7938 attention_modulation_curve_ordinate, &
7946 call debug_interpolate_plot_save( &
7947 grid_xx=attention_modulation_curve_abscissa, &
7948 grid_yy=attention_modulation_curve_ordinate, &
7949 ipol_value=this%gos_arousal, algstr=
"DDPINTERPOL", &
7950 output_file=
"plot_debug_attention_modulation_" // &
7951 tostr(global_time_step_model_current) // &
7952 mmdd //
"_a_"// trim(this%individ_label()) // &
7953 "_" // rand_string(label_length, label_cst,label_cen) &
7964 reset_dominant:
if ( this%motivations%hunger%is_dominant() )
then
7967 call this%motivations%hunger%attention_weight%attention_init &
7968 (weight_light = attention_switch_hunger_light, &
7969 weight_depth = attention_switch_hunger_depth, &
7970 weight_food_dir = attention_switch_hunger_food_dir, &
7971 weight_food_mem = attention_switch_hunger_food_mem, &
7972 weight_conspec = attention_switch_hunger_conspec, &
7973 weight_pred_dir = attention_switch_hunger_pred_dir, &
7974 weight_predator = attention_switch_hunger_predator, &
7975 weight_stomach = attention_switch_hunger_stomach, &
7976 weight_bodymass = attention_switch_hunger_bodymass, &
7977 weight_energy = attention_switch_hunger_energy, &
7978 weight_age = attention_switch_hunger_age, &
7979 weight_reprfac = attention_switch_hunger_reprfac )
7981 call this%motivations%fear_defence%attention_weight%attention_init &
7982 (weight_light = attention_switch_avoid_act_light * percept_w, &
7983 weight_depth = attention_switch_avoid_act_depth * percept_w, &
7984 weight_food_dir = attention_switch_avoid_act_food_dir * percept_w, &
7985 weight_food_mem = attention_switch_avoid_act_food_mem * percept_w, &
7986 weight_conspec = attention_switch_avoid_act_conspec * percept_w, &
7987 weight_pred_dir = attention_switch_avoid_act_pred_dir * percept_w, &
7988 weight_predator = attention_switch_avoid_act_predator * percept_w, &
7989 weight_stomach = attention_switch_avoid_act_stomach * percept_w, &
7990 weight_bodymass = attention_switch_avoid_act_bodymass * percept_w, &
7991 weight_energy = attention_switch_avoid_act_energy * percept_w, &
7992 weight_age = attention_switch_avoid_act_age * percept_w, &
7993 weight_reprfac = attention_switch_avoid_act_reprfac * percept_w )
7995 call this%motivations%reproduction%attention_weight%attention_init &
7996 (weight_light = attention_switch_reproduce_light * percept_w, &
7997 weight_depth = attention_switch_reproduce_depth * percept_w, &
7998 weight_food_dir = attention_switch_reproduce_food_dir * percept_w, &
7999 weight_food_mem = attention_switch_reproduce_food_mem * percept_w, &
8000 weight_conspec = attention_switch_reproduce_conspec * percept_w, &
8001 weight_pred_dir = attention_switch_reproduce_pred_dir * percept_w, &
8002 weight_predator = attention_switch_reproduce_predator * percept_w, &
8003 weight_stomach = attention_switch_reproduce_stomach * percept_w, &
8004 weight_bodymass = attention_switch_reproduce_bodymass * percept_w, &
8005 weight_energy = attention_switch_reproduce_energy * percept_w, &
8006 weight_age = attention_switch_reproduce_age * percept_w, &
8007 weight_reprfac = attention_switch_reproduce_reprfac * percept_w )
8011 else if ( this%motivations%fear_defence%is_dominant() )
then reset_dominant
8013 call this%motivations%hunger%attention_weight%attention_init &
8014 (weight_light = attention_switch_hunger_light * percept_w, &
8015 weight_depth = attention_switch_hunger_depth * percept_w, &
8016 weight_food_dir = attention_switch_hunger_food_dir * percept_w, &
8017 weight_food_mem = attention_switch_hunger_food_mem * percept_w, &
8018 weight_conspec = attention_switch_hunger_conspec * percept_w, &
8019 weight_pred_dir = attention_switch_hunger_pred_dir * percept_w, &
8020 weight_predator = attention_switch_hunger_predator * percept_w, &
8021 weight_stomach = attention_switch_hunger_stomach * percept_w, &
8022 weight_bodymass = attention_switch_hunger_bodymass * percept_w, &
8023 weight_energy = attention_switch_hunger_energy * percept_w, &
8024 weight_age = attention_switch_hunger_age * percept_w, &
8025 weight_reprfac = attention_switch_hunger_reprfac * percept_w )
8028 call this%motivations%fear_defence%attention_weight%attention_init &
8029 (weight_light = attention_switch_avoid_act_light, &
8030 weight_depth = attention_switch_avoid_act_depth, &
8031 weight_food_dir = attention_switch_avoid_act_food_dir, &
8032 weight_food_mem = attention_switch_avoid_act_food_mem, &
8033 weight_conspec = attention_switch_avoid_act_conspec, &
8034 weight_pred_dir = attention_switch_avoid_act_pred_dir, &
8035 weight_predator = attention_switch_avoid_act_predator, &
8036 weight_stomach = attention_switch_avoid_act_stomach, &
8037 weight_bodymass = attention_switch_avoid_act_bodymass, &
8038 weight_energy = attention_switch_avoid_act_energy, &
8039 weight_age = attention_switch_avoid_act_age, &
8040 weight_reprfac = attention_switch_avoid_act_reprfac )
8042 call this%motivations%reproduction%attention_weight%attention_init &
8043 (weight_light = attention_switch_reproduce_light * percept_w, &
8044 weight_depth = attention_switch_reproduce_depth * percept_w, &
8045 weight_food_dir = attention_switch_reproduce_food_dir * percept_w, &
8046 weight_food_mem = attention_switch_reproduce_food_mem * percept_w, &
8047 weight_conspec = attention_switch_reproduce_conspec * percept_w, &
8048 weight_pred_dir = attention_switch_reproduce_pred_dir * percept_w, &
8049 weight_predator = attention_switch_reproduce_predator * percept_w, &
8050 weight_stomach = attention_switch_reproduce_stomach * percept_w, &
8051 weight_bodymass = attention_switch_reproduce_bodymass * percept_w, &
8052 weight_energy = attention_switch_reproduce_energy * percept_w, &
8053 weight_age = attention_switch_reproduce_age * percept_w, &
8054 weight_reprfac = attention_switch_reproduce_reprfac * percept_w )
8058 else if ( this%motivations%reproduction%is_dominant() )
then reset_dominant
8060 call this%motivations%hunger%attention_weight%attention_init &
8061 (weight_light = attention_switch_hunger_light * percept_w, &
8062 weight_depth = attention_switch_hunger_depth * percept_w, &
8063 weight_food_dir = attention_switch_hunger_food_dir * percept_w, &
8064 weight_food_mem = attention_switch_hunger_food_mem * percept_w, &
8065 weight_conspec = attention_switch_hunger_conspec * percept_w, &
8066 weight_pred_dir = attention_switch_hunger_pred_dir * percept_w, &
8067 weight_predator = attention_switch_hunger_predator * percept_w, &
8068 weight_stomach = attention_switch_hunger_stomach * percept_w, &
8069 weight_bodymass = attention_switch_hunger_bodymass * percept_w, &
8070 weight_energy = attention_switch_hunger_energy * percept_w, &
8071 weight_age = attention_switch_hunger_age * percept_w, &
8072 weight_reprfac = attention_switch_hunger_reprfac * percept_w )
8074 call this%motivations%fear_defence%attention_weight%attention_init &
8075 (weight_light = attention_switch_avoid_act_light * percept_w, &
8076 weight_depth = attention_switch_avoid_act_depth * percept_w, &
8077 weight_food_dir = attention_switch_avoid_act_food_dir * percept_w, &
8078 weight_food_mem = attention_switch_avoid_act_food_mem * percept_w, &
8079 weight_conspec = attention_switch_avoid_act_conspec * percept_w, &
8080 weight_pred_dir = attention_switch_avoid_act_pred_dir * percept_w, &
8081 weight_predator = attention_switch_avoid_act_predator * percept_w, &
8082 weight_stomach = attention_switch_avoid_act_stomach * percept_w, &
8083 weight_bodymass = attention_switch_avoid_act_bodymass * percept_w, &
8084 weight_energy = attention_switch_avoid_act_energy * percept_w, &
8085 weight_age = attention_switch_avoid_act_age * percept_w, &
8086 weight_reprfac = attention_switch_avoid_act_reprfac * percept_w )
8089 call this%motivations%reproduction%attention_weight%attention_init &
8090 (weight_light = attention_switch_reproduce_light, &
8091 weight_depth = attention_switch_reproduce_depth, &
8092 weight_food_dir = attention_switch_reproduce_food_dir, &
8093 weight_food_mem = attention_switch_reproduce_food_mem, &
8094 weight_conspec = attention_switch_reproduce_conspec, &
8095 weight_pred_dir = attention_switch_reproduce_pred_dir, &
8096 weight_predator = attention_switch_reproduce_predator, &
8097 weight_stomach = attention_switch_reproduce_stomach, &
8098 weight_bodymass = attention_switch_reproduce_bodymass, &
8099 weight_energy = attention_switch_reproduce_energy, &
8100 weight_age = attention_switch_reproduce_age, &
8101 weight_reprfac = attention_switch_reproduce_reprfac )
8103 end if reset_dominant
8111 result(number_below)
8115 integer :: number_below
8123 if (.not. this%has_food())
then
8130 number_below = count( this%perceive_food%foods_seen .below. this )
8145 result(number_below)
8148 real(srp),
intent(in) :: hz_lower
8150 real(srp),
intent(in) :: hz_upper
8153 integer :: number_below
8164 if (.not. this%has_food())
then
8171 do concurrent(i=1:this%perceive_food%get_count())
8175 if ( is_within( this%perceive_food%foods_seen(i)%dpos(), &
8176 this%dpos() + hz_lower, &
8177 this%dpos() + hz_upper ) )
then
8178 number_below = number_below + 1
8188 result(mean_mass_below)
8192 real(srp) ::mean_mass_below
8195 integer :: i, n_counter
8200 mean_mass_below = 0.0_srp
8205 if (.not. this%has_food())
then
8213 do concurrent(i=1:this%perceive_food%get_count())
8220 if ( this%perceive_food%foods_seen(i) .below. this )
then
8225 mean_mass_below + this%perceive_food%foods_seen(i)%get_mass()
8226 n_counter = n_counter + 1
8233 if ( n_counter > 0 )
then
8234 mean_mass_below = mean_mass_below / real(n_counter, srp)
8236 mean_mass_below = 0.0_srp
8252 result(mean_mass_below)
8255 real(srp),
intent(in) :: hz_lower
8257 real(srp),
intent(in) :: hz_upper
8260 real(srp) ::mean_mass_below
8263 integer :: i, n_counter
8268 mean_mass_below = 0.0_srp
8273 if (.not. this%has_food())
then
8281 do concurrent(i=1:this%perceive_food%get_count())
8285 if ( is_within( this%perceive_food%foods_seen(i)%dpos(), &
8286 this%dpos() + hz_lower, &
8287 this%dpos() + hz_upper ) )
then
8292 mean_mass_below + this%perceive_food%foods_seen(i)%get_mass()
8293 n_counter = n_counter + 1
8300 if ( n_counter > 0 )
then
8301 mean_mass_below = mean_mass_below / real(n_counter, srp)
8303 mean_mass_below = 0.0_srp
8312 result(number_above)
8316 integer :: number_above
8324 if (.not. this%has_food())
then
8331 number_above = count( this%perceive_food%foods_seen .above. this )
8346 result(number_above)
8349 real(srp),
intent(in) :: hz_lower
8351 real(srp),
intent(in) :: hz_upper
8354 integer :: number_above
8365 if (.not. this%has_food())
then
8372 do concurrent(i=1:this%perceive_food%get_count())
8376 if ( is_within( this%perceive_food%foods_seen(i)%dpos(), &
8377 this%dpos() - hz_upper, &
8378 this%dpos() - hz_lower ) )
then
8379 number_above = number_above + 1
8389 result(mean_mass_above)
8391 real(srp) ::mean_mass_above
8394 integer :: i, n_counter
8399 mean_mass_above = 0.0_srp
8404 if (.not. this%has_food())
then
8412 do concurrent(i=1:this%perceive_food%get_count())
8419 if ( this%perceive_food%foods_seen(i) .above. this )
then
8424 mean_mass_above + this%perceive_food%foods_seen(i)%get_mass()
8425 n_counter = n_counter + 1
8432 if ( n_counter > 0 )
then
8433 mean_mass_above = mean_mass_above / real(n_counter, srp)
8435 mean_mass_above = 0.0_srp
8451 result(mean_mass_above)
8454 real(srp),
intent(in) :: hz_lower
8456 real(srp),
intent(in) :: hz_upper
8459 real(srp) ::mean_mass_above
8462 integer :: i, n_counter
8467 mean_mass_above = 0.0_srp
8472 if (.not. this%has_food())
then
8480 do concurrent(i=1:this%perceive_food%get_count())
8484 if ( is_within( this%perceive_food%foods_seen(i)%dpos(), &
8485 this%dpos() - hz_upper, &
8486 this%dpos() - hz_lower ) )
then
8491 mean_mass_above + this%perceive_food%foods_seen(i)%get_mass()
8492 n_counter = n_counter + 1
8499 if ( n_counter > 0 )
then
8500 mean_mass_above = mean_mass_above / real(n_counter, srp)
8502 mean_mass_above = 0.0_srp
8511 result(number_below)
8515 integer :: number_below
8523 if (.not. this%has_consp())
then
8530 number_below = count( this%perceive_consp%conspecifics_seen .below. this )
8538 result(number_above)
8542 integer :: number_above
8550 if (.not. this%has_consp())
then
8557 number_above = count( this%perceive_consp%conspecifics_seen .above. this )
8570 result(number_below)
8573 real(srp),
intent(in) :: hz_lower
8575 real(srp),
intent(in) :: hz_upper
8578 integer :: number_below
8589 if (.not. this%has_consp())
then
8596 do concurrent(i=1:this%perceive_consp%get_count())
8597 if ( this%perceive_consp%conspecifics_seen(i)%dpos() .within. &
8598 [this%dpos()+hz_lower, this%dpos()+hz_upper] )
then
8599 number_below = number_below + 1
8614 result(number_above)
8617 real(srp),
intent(in) :: hz_lower
8619 real(srp),
intent(in) :: hz_upper
8622 integer :: number_above
8633 if (.not. this%has_food())
then
8640 do concurrent(i=1:this%perceive_consp%get_count())
8641 if ( this%perceive_consp%conspecifics_seen(i)%dpos() .within. &
8642 [this%dpos()-hz_upper, this%dpos()-hz_lower] )
then
8643 number_above = number_above + 1
8653 result(number_below)
8657 integer :: number_below
8665 if (.not. this%has_pred())
then
8672 number_below = count( this%perceive_predator%predators_seen .below. this )
8680 result(number_above)
8684 integer :: number_above
8692 if (.not. this%has_pred())
then
8699 number_above = count( this%perceive_predator%predators_seen .above. this )
8712 result(number_below)
8715 real(srp),
intent(in) :: hz_lower
8717 real(srp),
intent(in) :: hz_upper
8720 integer :: number_below
8731 if (.not. this%has_pred())
then
8738 do concurrent(i=1:this%perceive_predator%get_count())
8739 if ( this%perceive_predator%predators_seen(i)%dpos() .within. &
8740 [this%dpos()+hz_lower, this%dpos()+hz_upper] )
then
8741 number_below = number_below + 1
8756 result(number_above)
8759 real(srp),
intent(in) :: hz_lower
8761 real(srp),
intent(in) :: hz_upper
8764 integer :: number_above
8775 if (.not. this%has_pred())
then
8782 do concurrent(i=1:this%perceive_predator%get_count())
8783 if ( this%perceive_predator%predators_seen(i)%dpos() .within. &
8784 [this%dpos()-hz_upper, this%dpos()-hz_lower] )
then
8785 number_above = number_above + 1
8799 real(srp) ::mean_dist
8802 integer :: i, n_counter
8811 if (.not. this%has_food())
then
8820 do concurrent(i=1:this%perceive_food%get_count())
8825 if ( this%perceive_food%foods_seen(i) .below. this )
then
8828 mean_dist + this%distance( this%perceive_food%foods_seen(i) )
8829 n_counter = n_counter + 1
8839 if ( n_counter > 0 )
then
8840 mean_dist = mean_dist / real(n_counter, srp)
8855 real(srp) ::mean_dist
8858 integer :: i, n_counter
8867 if (.not. this%has_food())
then
8876 do concurrent(i=1:this%perceive_food%get_count())
8881 if ( this%perceive_food%foods_seen(i) .above. this )
then
8884 mean_dist + this%distance( this%perceive_food%foods_seen(i) )
8885 n_counter = n_counter + 1
8895 if ( n_counter > 0 )
then
8896 mean_dist = mean_dist / real(n_counter, srp)
8911 real(srp) ::mean_dist
8914 integer :: i, n_counter
8923 if (.not. this%has_consp())
then
8932 do concurrent(i=1:this%perceive_consp%get_count())
8937 if ( this%perceive_consp%conspecifics_seen(i) .below. this )
then
8939 mean_dist + this%distance( &
8940 this%perceive_consp%conspecifics_seen(i) )
8941 n_counter = n_counter + 1
8948 if ( n_counter > 0 )
then
8949 mean_dist = mean_dist / real(n_counter, srp)
8964 real(srp) ::mean_dist
8967 integer :: i, n_counter
8976 if (.not. this%has_consp())
then
8985 do concurrent(i=1:this%perceive_consp%get_count())
8990 if ( this%perceive_consp%conspecifics_seen(i) .above. this )
then
8992 mean_dist + this%distance( &
8993 this%perceive_consp%conspecifics_seen(i) )
8994 n_counter = n_counter + 1
9001 if ( n_counter > 0 )
then
9002 mean_dist = mean_dist / real(n_counter, srp)
9017 real(srp) ::mean_dist
9020 integer :: i, n_counter
9029 if (.not. this%has_pred())
then
9038 do concurrent(i=1:this%perceive_predator%get_count())
9043 if ( this%perceive_predator%predators_seen(i) .below. this )
then
9045 mean_dist + this%distance( &
9046 this%perceive_predator%predators_seen(i) )
9047 n_counter = n_counter + 1
9054 if ( n_counter > 0 )
then
9055 mean_dist = mean_dist / real(n_counter, srp)
9070 real(srp) ::mean_dist
9073 integer :: i, n_counter
9082 if (.not. this%has_pred())
then
9091 do concurrent(i=1:this%perceive_predator%get_count())
9096 if ( this%perceive_predator%predators_seen(i) .above. this )
then
9098 mean_dist + this%distance( &
9099 this%perceive_predator%predators_seen(i) )
9100 n_counter = n_counter + 1
9107 if ( n_counter > 0 )
then
9108 mean_dist = mean_dist / real(n_counter, srp)
9133 this_predator, attack_rate, &
9134 is_freezing, time_step_model) &
9144 real(srp),
intent(in) :: attack_rate
9148 logical,
optional,
intent(in) :: is_freezing
9152 integer,
optional,
intent(in) :: time_step_model
9154 real(srp) :: risk_pred
9157 type(predator) :: tmp_predator
9160 integer :: time_step_model_here
9161 logical :: is_freezing_loc
9164 real(srp) :: distance_pred
9166 character(FILENAME_LENGTH) :: debug_plot_file
9184 if (.not. this%has_pred())
then
9191 if (
present(time_step_model))
then
9192 time_step_model_here = time_step_model
9194 time_step_model_here = global_time_step_model_current
9198 if (
present(is_freezing))
then
9199 is_freezing_loc = is_freezing
9201 is_freezing_loc = .false.
9214 call tmp_predator%make( body_size=this_predator%get_size(), &
9215 attack_rate=attack_rate, &
9216 position=this_predator%location(), &
9217 label=
"tmp_object" )
9221 distance_pred = this%distance( this_predator )
9225 debug_plot_file =
"plot_debug_predation_risk_" &
9226 // tostr(global_time_step_model_current) //
"_" // &
9227 mmdd //
"_a_" // trim(this%individ_label()) &
9229 rand_string(label_length, label_cst,label_cen) // ps
9234 risk_pred = tmp_predator%risk_fish(prey_spatial=this%location(), &
9235 prey_length=this%get_length(), &
9236 prey_distance=distance_pred, &
9237 is_freezing=is_freezing_loc, &
9238 time_step_model=time_step_model_here, &
9239 debug_plot_file=debug_plot_file )
9252 is_freezing, time_step_model) &
9256 class(predator),
intent(in) :: this_predator
9260 logical,
optional,
intent(in) :: is_freezing
9264 integer,
optional,
intent(in) :: time_step_model
9266 real(srp) :: risk_pred
9269 integer :: time_step_model_here
9270 logical :: is_freezing_loc
9273 real(srp) :: distance_pred
9275 character(FILENAME_LENGTH) :: debug_plot_file
9294 if (.not. this%has_pred())
then
9295 risk_pred = this_predator%attack_rate * &
9296 predator_attack_capture_probability_min
9302 if (
present(time_step_model))
then
9303 time_step_model_here = time_step_model
9305 time_step_model_here = global_time_step_model_current
9309 if (
present(is_freezing))
then
9310 is_freezing_loc = is_freezing
9312 is_freezing_loc = .false.
9317 distance_pred = this%distance( this_predator )
9321 debug_plot_file =
"plot_debug_predation_risk_" &
9322 // tostr(global_time_step_model_current) //
"_" // &
9323 mmdd //
"_a_" // trim(this%individ_label()) &
9325 rand_string(label_length, label_cst,label_cen) // ps
9330 risk_pred = this_predator%risk_fish(prey_spatial=this%location(), &
9331 prey_length=this%get_length(), &
9332 prey_distance=distance_pred, &
9333 is_freezing=is_freezing_loc, &
9334 time_step_model=time_step_model_here, &
9335 debug_plot_file=debug_plot_file )
9348 logical,
optional,
intent(in) :: is_freezing
9353 logical :: is_freezing_loc
9356 if (
present(is_freezing))
then
9357 is_freezing_loc = is_freezing
9359 is_freezing_loc = .false.
9362 if (this%has_pred())
then
9363 risk = this%risk_pred( this%perceive_predator%predators_seen(1), &
9364 this%perceive_predator%predators_attack_rates(1),&
9365 is_freezing=is_freezing_loc )
9383 class(spatial),
intent(in) :: this
9397 size = this%get_size()
9402 class is (condition)
9403 size = this%get_length()
9424 class(spatial),
intent(in) :: this
9438 mass = this%get_mass()
9443 class is (condition)
9444 mass = this%get_mass()
9457 Simple history stack function, add to the end of the stack. We need only to add components on top (en...
Calculate an average of an array excluding missing code values.
Force a value within the range set by the vmin and vmax dummy parameter values.
Internal distance calculation backend engine.
Calculate underwater background irradiance at specific depth.
Calculate surface light intensity (that is subject to diel variation) for specific time step of the m...
Calculate visual range of predator using Dag Aksnes's procedures srgetr(), easyr() and deriv().
Abstract interface for the deferred init function clean_init that has to be overridden by each object...
elemental real(srp) function asymptotic(max_level, x)
Definition of the asymptotic function for converting the primary genotype-based modulation coefficien...
pure real(srp) function arousal_decrease_factor_fixed(time_step)
real(srp) function arousal_decrease_factor_nonpar(time_step)
COMMONDATA – definitions of global constants and procedures.
logical, parameter, public agent_can_assess_predator_attack_rate
A logical flag of whether the agents can assess the individual inherent attack rates of the predators...
integer, parameter, public pred_select_items_index_partial
Sets the limit for partial indexing and ranking of predators in the visual range of the agent.
real(srp), parameter, public body_length_max
Maximum body length.
integer, parameter, public srp
Definition of the standard real type precision (SRP).
elemental real(srp) function cv2variance(cv, mean)
Calculate the variance from the coefficient of variation.
integer, parameter, public unknown
Numerical code for invalid or missing integer counts.
integer, parameter, public history_size_perception
Sets the size of the perception memory stack.
integer, parameter, public food_select_items_index_partial
Sets the limit for partial indexing and ranking of food items in the visual range of the agents.
real(srp), parameter, public predation_risk_weight_immediate
The weight of the immediately seen predators over those in the perceptual memory stack....
real(srp), parameter, public missing
Numerical code for missing and invalid real type values.
logical, parameter, public daylight_stochastic
Flag for stochastic daylight pattern (if TRUE) or deterministic sinusoidal (when FALSE)....
subroutine log_dbg(message_string, procname, modname)
LOG_DBG: debug message to the log. The message goes to the logger only when running in the DEBUG mode...
real(srp), parameter, public body_mass_min
Minimum possible body mass, hard limit.
logical, parameter, public true
Safety parameter avoid errors in logical values, so we can now refer to standard Fortran ....
real(srp), parameter, public predator_attack_rate_default
Mean rate of a single predator attack.
real(srp), parameter, public zero
Some parameters should never be zero or below. In such cases they could be set to some smallest disti...
real(srp), parameter, public preycontrast_default
Inherent contrast of prey, CONTRAST =1.0.
real(srp), parameter, public food_item_capture_probability_subjective_errorr_cv
Subjective error assessing the food item capture probability when assessing the subjective GOS expect...
elemental real(srp) function carea(R)
Calculate a circle area.
character(len= *), parameter, public ltag_warn
real(srp), parameter, public body_length_min
Minimum body length possible.
integer, public global_time_step_model_current
The current global time step of the model. This is a global non fixed-parameter variable that is upda...
character(len= *), parameter, private procname
PROCNAME is the procedure name for logging and debugging (with commondata::modname).
elemental real(srp) function length2sidearea_fish(body_length)
A function linking body length with the body area in fish.
integer, parameter, public consp_select_items_index_partial
Sets the limit for partial indexing and ranking of conspecifics in the visual range of the agent.
real(srp), parameter, public individual_visual_contrast_default
Inherent contrast of the agent, It is used in determining the visual range of an agent in perception ...
logical, parameter, public false
character(len= *), parameter, public ltag_info
Definition the physical properties and condition of the agent.
character(len= *), parameter, private modname
elemental real(srp) function energy_reserve(m, l)
Calculate the current energy reserves (Fulton condition factor) from body mass and length.
Definition of environmental objects.
elemental real(srp) function size2mass_food(radius)
Calculate the mass of a food item, the non-OO backend.
Definition of the decision making and behavioural the architecture.
elemental real(srp) function state_motivation_food_dir_get(this)
Standard "get" function for the state neuronal directly seen food effect component.
subroutine perception_objects_get_all_inner(this)
A single umbrella subroutine wrapper to get all inner perceptions: stomach, body mass,...
subroutine percept_energy_update_current(this, current)
Set and update the current energy perception value.
elemental subroutine appraisal_agent_set_dead(this)
Set the individual to be dead. Note that this function does not deallocate the individual agent objec...
elemental real(srp) function percept_memory_consp_get_mean_n(this, last)
Get the average number of conspecifics per single time step within the whole perceptual memory stack.
elemental subroutine percept_reprfac_create_init(this)
Make en empty reproductive factor perception component. Really necessary only when perception objects...
elemental real(srp) function emotional_memory_actve_avoid_get_mean(this, last)
Get the average value of the fear state motivation state within the whole emotional memory stack.
elemental subroutine percept_light_create_init(this)
Make en empty light perception component. Really necessary only when perception objects are all alloc...
elemental real(srp) function perception_food_dist_below_calculate(this)
Calculate the average distance to all food items in the current perception object that are below the ...
elemental subroutine percept_age_destroy_deallocate(this)
Destroy the age perception object and deallocate it.
elemental real(srp) function state_motivation_age_get(this)
Standard "get" function for the state neuronal age effect component.
subroutine depth_perception_get_object(this)
Get depth perception objects into the individual PERCEPTION object layer.
subroutine percept_bodymass_update_current(this, current)
Set and update the current body mass perception value.
elemental real(srp) function perception_predator_dist_below_calculate(this)
Calculate the average distance to all predators in the current perception object that are below the a...
elemental integer function perception_predator_below_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of predators in the perception object that are located below the actor agent wit...
elemental subroutine appraisal_primary_motivations_calculate(this, rescale_max_motivation)
Calculate primary motivations from perceptual components of each motivation state.
elemental integer function percept_age_get_current(this)
Get the current value of the age reserves.
subroutine perception_components_neuronal_response_init_set(this, this_agent, param_gp_matrix_light, param_gp_matrix_depth, param_gp_matrix_food_dir, param_gp_matrix_food_mem, param_gp_matrix_conspec, param_gp_matrix_pred_dir, param_gp_matrix_predator, param_gp_matrix_stomach, param_gp_matrix_bodymass, param_gp_matrix_energy, param_gp_matrix_age, param_gp_matrix_reprfac, param_gerror_cv_light, param_gerror_cv_depth, param_gerror_cv_food_dir, param_gerror_cv_food_mem, param_gerror_cv_conspec, param_gerror_cv_pred_dir, param_gerror_cv_predator, param_gerror_cv_stomach, param_gerror_cv_bodymass, param_gerror_cv_energy, param_gerror_cv_age, param_gerror_cv_reprfac, param_gene_label_light, param_gene_label_depth, param_gene_label_food_dir, param_gene_label_food_mem, param_gene_label_conspec, param_gene_label_pred_dir, param_gene_label_predator, param_gene_label_stomach, param_gene_label_bodymass, param_gene_label_energy, param_gene_label_age, param_gene_label_reprfac)
Set and calculate individual perceptual components for this motivational state using the neuronal res...
elemental real(srp) function percept_energy_get_current(this)
Get the current value of the energy reserves.
elemental real(srp) function consp_percept_get_size(this)
Get the conspecific perception component body size.
elemental subroutine gos_agent_set_dead(this)
Set the individual to be dead. Note that this function does not deallocate the individual agent objec...
elemental real(srp) function percept_memory_food_get_mean_size(this, last)
Get the average size of food item per single time step within the whole perceptual memory stack.
elemental subroutine percept_depth_destroy_deallocate(this)
Destroy / deallocate depth perception component. Really necessary only when perception objects are al...
real(srp) function predator_capture_probability_calculate_pred(this, this_predator, is_freezing, time_step_model)
Calculate the probability of attack and capture of the this agent by the predator this_predator....
elemental subroutine percept_consp_create_init(this, maximum_number_conspecifics)
Create conspecifics perception object, it is an array of conspecific perception components.
elemental real(srp) function state_motivation_stomach_get(this)
Standard "get" function for the state neuronal stomach effect component.
elemental real(srp) function percept_food_get_meandist_found(this)
Get the average distance to the food items seen. Trivial.
subroutine appraisal_perceptual_comps_motiv_neur_response_calculate(this)
Get the perceptual components of all motivational states by passing perceptions via the neuronal resp...
elemental real(srp) function motivation_maximum_value_motivation_finl(this)
Calculate the maximum value of the final motivations across all motivational state components.
elemental real(srp) function state_motivation_predator_get(this)
Standard "get" function for the state neuronal predators effect component.
elemental real(srp) function state_motivation_percept_maxval(this)
Calculate the maximum value over all the perceptual components of this motivational state component.
subroutine consp_percept_make(this, location, size, mass, dist, cid, is_male)
Make a single conspecific perception component. This is a single conspecific located within the visua...
logical function reproduction_success_stochast(this, prob)
Determine a stochastic outcome of this agent reproduction. Returns TRUE if the agent has reproduced s...
elemental subroutine percept_predator_create_init(this, maximum_number_predators)
Create predator perception object, it is an array of spatial perception components.
elemental real(srp) function spatialobj_percept_get_dist(this)
Get the distance to an arbitrary spatial object perception component.
elemental subroutine consp_percept_comp_create(this)
Create a single conspecific perception component at an undefined position with default properties.
elemental subroutine percept_consp_destroy_deallocate(this)
Deallocate and delete a conspecific perception object.
elemental subroutine percept_bodymass_create_init(this)
Initiate an empty body mass perception object.
elemental logical function food_perception_is_seeing_food(this)
Check if the agent sees any food items within its visual range.
elemental subroutine percept_stomach_create_init(this)
Initiate an empty stomach capacity perception object.
elemental integer function percept_consp_get_count_seen(this)
Get the number (count) of conspecifics seen. Trivial.
subroutine food_perception_get_visrange_objects(this, food_resource_available, time_step_model)
Get available food items within the visual range of the agent, which the agent can perceive and there...
elemental subroutine percept_food_create_init(this, maximum_number_food_items)
Initiate an empty food perception object with known number of components.
elemental real(srp) function predation_risk_backend(pred_count, pred_memory_mean, weight_direct)
Simple computational backend for the risk of predation that is used in objective risk function the_ne...
elemental subroutine, private gos_init_zero_state(this)
Initialise GOS engine components to a zero state. The values are set to commondata::missing,...
elemental logical function motivation_val_is_maximum_value_motivation_finl(this, test_value)
Checks if the test value is the maximum final motivation value across all motivational state componen...
elemental integer function perception_predator_above_calculate(this)
Calculate the number of predators in the perception object that are located above the actor agent.
elemental subroutine percept_memory_predators_mean_split(this, window, split_val, older, newer)
Get the average number of predators per single time step within the perceptual memory stack,...
elemental real(srp) function state_motivation_motivation_prim_get(this)
Standard "get" function for the root state, get the overall primary motivation value (before modulati...
elemental subroutine motivation_reset_gos_indicators(this)
Reset all GOS indicators for this motivation object.
elemental subroutine, private perception_objects_init_agent(this)
Initialise all the perception objects for the current agent. Do not fill perception objects with the ...
elemental integer function perception_predator_below_calculate(this)
Calculate the number of predators in the perception object that are located below the actor agent.
real(srp) function predator_capture_probability_calculate_spatobj(this, this_predator, attack_rate, is_freezing, time_step_model)
Calculate the probability of attack and capture of the this agent by the predator this_predator....
elemental real(srp) function perception_predator_dist_above_calculate(this)
Calculate the average distance to all predators in the current perception object that are above the a...
elemental subroutine gos_reset_motivations_non_dominant(this)
Reset all motivation states as not dominant with respect to the GOS.
subroutine spatial_percept_set_cid(this, id)
Set unique id for the conspecific perception component.
pure subroutine percept_consp_make_fill_arrays(this, consps)
Make the conspecifics perception object, fill it with the actual arrays.
elemental integer function perception_predator_above_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of predators in the perception object that are located above the actor agent wit...
subroutine perception_components_neuronal_response_calculate(this, this_agent, param_gp_matrix_light, param_gp_matrix_depth, param_gp_matrix_food_dir, param_gp_matrix_food_mem, param_gp_matrix_conspec, param_gp_matrix_pred_dir, param_gp_matrix_predator, param_gp_matrix_stomach, param_gp_matrix_bodymass, param_gp_matrix_energy, param_gp_matrix_age, param_gp_matrix_reprfac, param_gerror_cv_light, param_gerror_cv_depth, param_gerror_cv_food_dir, param_gerror_cv_food_mem, param_gerror_cv_conspec, param_gerror_cv_pred_dir, param_gerror_cv_predator, param_gerror_cv_stomach, param_gerror_cv_bodymass, param_gerror_cv_energy, param_gerror_cv_age, param_gerror_cv_reprfac, perception_override_light, perception_override_depth, perception_override_food_dir, perception_override_food_mem, perception_override_conspec, perception_override_pred_dir, perception_override_predator, perception_override_stomach, perception_override_bodymass, perception_override_energy, perception_override_age, perception_override_reprfac)
Calculate individual perceptual components for this motivational state using the neuronal response fu...
elemental real(srp) function get_prop_mass(this)
Get the body mass property of a polymorphic object. The object can be of the following extension of t...
elemental subroutine percept_memory_food_mean_size_split(this, window, split_val, older, newer)
Get the average size of food items per single time step within the perceptual memory stack,...
elemental real(srp) function percept_memory_food_get_mean_n(this, last)
Get the average number of food items per single time step within the whole perceptual memory stack.
elemental character(len=label_length) function state_motivation_fixed_label_get(this)
Get the fixed label for this motivational state. Note that the label is fixed and cannot be changed.
real(srp) function food_perception_probability_capture_memory_object(this, last, time_step_model)
Calculate the probability of capture of a subjective representation of food item based on the data fr...
elemental real(srp) function consp_percept_get_dist(this)
Get the conspecific perception component distance.
elemental integer function perception_food_items_above_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of food items in the perception object that are located above the actor agent wi...
subroutine percept_light_set_current(this, timestep, depth)
Set the current light level into the perception component.
subroutine age_perception_get_object(this)
Get the age perception objects into the individual PERCEPTION object layer.
elemental subroutine state_reproduce_zero(this)
Init and cleanup reproductive motivation object. The only difference from the base root STATE_MOTIVAT...
elemental subroutine motivation_primary_sum_components(this, max_val)
Calculate the primary motivations from motivation-specific perception appraisal components....
elemental real(srp) function state_motivation_conspec_get(this)
Standard "get" function for the state neuronal conspecifics effect component.
elemental subroutine percept_consp_number_seen(this, number_set)
Set the total number of conspecifics perceived (seen) in the conspecific perception object....
elemental real(srp) function emotional_memory_hunger_get_mean(this, last)
Get the average value of the hunger motivation state within the whole emotional memory stack.
elemental subroutine percept_reprfac_destroy_deallocate(this)
Destroy / deallocate reproductive factor perception component. Really necessary only when perception ...
character(len= *), parameter, private modname
pure real(srp) function, dimension(:), allocatable motivation_return_final_as_vector(this)
Return the vector of final motivation values for all motivational state components.
elemental real(srp) function get_prop_size(this)
Get the body size property of a polymorphic object. The object can be of the following extension of t...
elemental subroutine percept_light_destroy_deallocate(this)
Destroy / deallocate light perception component. Really necessary only when perception objects are al...
elemental subroutine percept_food_destroy_deallocate(this)
Deallocate and delete a food perception object.
subroutine energy_perception_get_object(this)
Get the energy reserves perception objects into the individual PERCEPTION object layer.
subroutine spatialobj_percept_make(this, location, size, dist, cid)
Make a single arbitrary spatial object perception component.
elemental real(srp) function consp_percept_get_mass(this)
Get the conspecific perception component body mass.
real(srp) function spatialobj_percept_visibility_visual_range(this, object_area, contrast, time_step_model)
Calculate the visibility range of this spatial object. Wrapper to the visual_range function....
elemental subroutine, private appraisal_init_zero_cleanup_all(this)
Initialise and cleanup all appraisal object components and sub-objects.
elemental real(srp) function perception_food_mass_below_calculate(this)
Calculate the average mass of a food item from all the items in the current perception object that ar...
elemental subroutine percept_predator_number_seen(this, number_set)
Set the total number of predators perceived (seen) in the predator perception object....
elemental real(srp) function perception_food_mass_above_horiz_calculate(this, hz_lower, hz_upper)
Calculate the average mass of a food item from all the items in the current perception object that ar...
elemental real(srp) function percept_depth_get_current(this)
Get the current perception of the depth.
elemental real(srp) function perception_food_mass_below_horiz_calculate(this, hz_lower, hz_upper)
Calculate the average mass of a food item from all the items in the current perception object that ar...
elemental real(srp) function state_motivation_food_mem_get(this)
Standard "get" function for the state neuronal food items from past memory effect component.
elemental real(srp) function percept_food_get_meansize_found(this)
Get the average size of food items seen. Trivial.
elemental real(srp) function percept_reprfac_get_current(this)
Get the current perception of the reproductive factor.
subroutine consp_perception_get_visrange_objects(this, consp_agents, time_step_model)
Get available conspecific perception objects within the visual range of the agent,...
subroutine percept_food_number_seen(this, number_set)
Set the total number of food items perceived (seen) in the food perception object....
elemental integer function perception_food_items_below_calculate(this)
Calculate the number of food items in the perception object that are located below the actor agent.
elemental integer function perception_conspecifics_above_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of conspecifics in the perception object that are located above the actor agent ...
subroutine light_perception_get_object(this, time_step_model)
Get light perception objects into the individual PERCEPTION object layer.
subroutine predator_perception_get_visrange_objects(this, spatl_agents, time_step_model)
Get available predators perception objects within the visual range of the agent, which the agent can ...
elemental logical function state_motivation_is_dominant_get(this)
Check if the root state is the dominant state in GOS.
real(srp) function reproduce_do_probability_reproduction_calc(this, weight_baseline, allow_immature)
Calculate the instantaneous probability of successful reproduction.
elemental real(srp) function perception_food_mass_above_calculate(this)
Calculate the average mass of a food item from all the items in the current perception object that ar...
elemental logical function consp_perception_is_seeing_conspecifics(this)
Check if the agent sees any conspecifics within the visual range.
elemental real(srp) function perception_consp_dist_above_calculate(this)
Calculate the average distance to all conspecifics in the current perception object that are above th...
elemental subroutine percept_energy_create_init(this)
Initiate an empty energy perception object.
subroutine bodymass_perception_get_object(this)
Get the body mass perception objects into the individual PERCEPTION object layer.
pure subroutine percept_predator_make_fill_arrays(this, preds, attack_rate)
Make the predator perception object, fill it with the actual arrays.
subroutine percept_food_make_fill_arrays(this, items, dist)
Make the food perception object, fill it with the actual data arrays.
elemental integer function spatial_percept_get_cid(this)
Get the unique id of the food item object.
elemental integer function perception_food_items_above_calculate(this)
Calculate the number of food items in the perception object that are located above the actor agent.
elemental subroutine percept_depth_create_init(this)
Make en empty depth perception component. Really necessary only when perception objects are all alloc...
elemental logical function predator_perception_is_seeing_predators(this)
Check if the agent sees any predators within the visual range.
elemental integer function perception_conspecifics_below_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of conspecifics in the perception object that are located below the actor agent ...
elemental subroutine percept_memory_cleanup_stack(this)
Cleanup and destroy the perceptual memory stack.
elemental logical function consp_percept_sex_is_female_get(this)
Get the conspecific perception component sex flag (female).
elemental subroutine spatialobj_percept_comp_create(this)
Create a single arbitrary spatial object perception component at an undefined position with default p...
elemental subroutine perception_components_attention_weights_init(this, all_vals_fix, all_one, weight_light, weight_depth, weight_food_dir, weight_food_mem, weight_conspec, weight_pred_dir, weight_predator, weight_stomach, weight_bodymass, weight_energy, weight_age, weight_reprfac)
Initialise the attention components of the emotional state to their default parameter values....
elemental subroutine percept_predator_destroy_deallocate(this)
Deallocate and delete a predator perception object.
elemental real(srp) function percept_light_get_current(this)
Get the current perception of the illumination.
elemental subroutine emotional_memory_cleanup_stack(this)
Cleanup and destroy the emotional memory stack.
subroutine perception_objects_get_all_environmental(this)
A single umbrella subroutine to get all environmental perceptions: light, depth. This procedure invok...
elemental real(srp) function state_motivation_reprfac_get(this)
Standard "get" function for the state neuronal reproductive factor effect component.
elemental real(srp) function spatialobj_percept_get_size(this)
Get an arbitrary spatial object perception component size.
subroutine gos_find_global_state(this)
Find and set the Global Organismic State (GOS) of the agent based on the various available motivation...
elemental subroutine percept_memory_food_mean_n_split(this, window, split_val, older, newer)
Get the average number of food items per single time step within the perceptual memory stack,...
elemental logical function motivation_val_is_maximum_value_motivation_finl_o(this, test_motivation)
Checks if the test value is the maximum final motivation value across all motivational state componen...
elemental subroutine emotional_memory_add_gos_to_stack(this, v_gos_label, v_gos_arousal, v_gos_repeated)
Add the current GOS label or/and arousal value and/or arousal repeat count into the emotional memory ...
elemental subroutine percept_bodymass_destroy_deallocate(this)
Destroy the body mass perception object and deallocate.
elemental integer function percept_memory_predators_get_total(this)
Get the total number of predators within the whole perceptual memory stack.
elemental real(srp) function gos_get_arousal_level(this)
Get the overall level of arousal. Arousal is the current level of the dominant motivation that has br...
elemental integer function perception_conspecifics_above_calculate(this)
Calculate the number of conspecifics in the perception object that are located above the actor agent.
elemental real(srp) function percept_memory_predators_get_mean(this, last)
Get the average number of predators per single time step within the whole perceptual memory stack.
elemental real(srp) function percept_memory_food_get_mean_dist(this, last, undef_ret_null)
Get the average distance to food item per single time step within the whole perceptual memory stack.
subroutine gos_attention_modulate_weights(this)
Modulate the attention weights to suppress all perceptions alternative to the current GOS....
subroutine appraisal_motivation_modulation_non_genetic(this, no_modulation)
Produce modulation of the primary motivations, that result in the final motivation values (_finl)....
subroutine repfac_perception_get_object(this)
Get the reproductive factor perception objects into the individual PERCEPTION object layer.
elemental real(srp) function percept_stomach_get_avail_capacity(this)
Get the currently available value of the available stomach volume.
elemental real(srp) function state_motivation_pred_dir_get(this)
Standard "get" function for the state neuronal direct predation effect component.
elemental integer function percept_predator_get_count_seen(this)
Get the number (count) of predators seen. Trivial.
elemental subroutine perception_objects_destroy(this, clean_memory)
Destroy and deallocate all perception objects.
elemental real(srp) function percept_food_get_meanmass_found(this)
Get the average mass of food items seen. Trivial.
elemental character(len=label_length) function gos_global_get_label(this)
Get the current global organismic state (GOS).
elemental real(srp) function perception_predation_risk_objective(this)
Calculate the risk of predation as being perceived / assessed by this agent.
pure subroutine state_motivation_attention_weights_transfer(this, copy_from)
Transfer attention weights between two motivation state components. The main use of this subroutine w...
elemental subroutine emotional_memory_add_to_stack(this, v_hunger, v_defence_fear, v_reproduction, v_gos_label, v_gos_arousal, v_gos_repeated)
Add emotional components into the memory stack.
subroutine percept_reprfac_set_current(this, reprfac)
Set the current reproductive factor level into perception component.
elemental real(srp) function perception_consp_dist_below_calculate(this)
Calculate the average distance to all conspecifics in the current perception object that are below th...
elemental subroutine percept_memory_add_to_stack(this, light, depth, food, foodsize, fooddist, consp, pred, stom, bdmass, energ, reprfac)
Add perception components into the memory stack.
elemental subroutine motivation_init_all_zero(this)
Init the expectancy components to a zero state.
elemental logical function consp_percept_sex_is_male_get(this)
Get the conspecific perception component sex flag (male).
elemental real(srp) function percept_bodymass_get_current(this)
Get the current value of the body mass perception.
elemental subroutine percept_energy_destroy_deallocate(this)
Destroy the energy perception object and deallocate.
elemental subroutine percept_age_create_init(this)
Initiate an empty age perception object.
elemental integer function percept_memory_food_get_total(this)
Get the total number of food items within the whole perceptual memory stack.
elemental subroutine perception_objects_add_memory_stack(this)
Add the various perception objects to the memory stack object. This procedure is called after all the...
elemental real(srp) function state_motivation_calculate_prim(this, maxvalue)
Calculate the level of primary motivation for this specific emotional state component.
elemental real(srp) function state_motivation_bodymass_get(this)
Standard "get" function for the state neuronal body mass effect component.
elemental real(srp) function state_motivation_light_get(this)
Standard "get" function for the state neuronal light effect component.
subroutine percept_stomach_update_avail_capacity(this, current_volume)
Set and update the currently available value of the available stomach volume.
pure subroutine percept_predator_set_attack_rate_scalar(this, attack_rate)
Set an array of the attack rates for the predator perception object.
elemental real(srp) function perception_component_maxval(this)
Calculate the maximum value over all the perceptual components.
elemental subroutine percept_stomach_destroy_deallocate(this)
Destroy the stomach perception object and deallocate it.
elemental integer function percept_food_get_count_found(this)
Get the number (count) of food items seen. Trivial.
elemental real(srp) function state_motivation_depth_get(this)
Standard "get" function for the state neuronal depth effect component.
elemental subroutine appraisal_add_final_motivations_memory(this)
Add individual final emotional state components into the emotional memory stack. This is a wrapper to...
elemental subroutine state_hunger_zero(this)
Init and cleanup hunger motivation object. The only difference from the base root STATE_MOTIVATION_BA...
elemental real(srp) function state_motivation_energy_get(this)
Standard "get" function for the state neuronal energy reserves effect component.
elemental real(srp) function emotional_memory_reproduct_get_mean(this, last)
Get the average value of the reproductive motivation state within the whole emotional memory stack.
subroutine percept_depth_set_current(this, cdepth)
Set the current depth level into the perception component.
elemental integer function perception_food_items_below_horiz_calculate(this, hz_lower, hz_upper)
Calculate the number of food items in the perception object that are located below the actor agent wi...
subroutine appraisal_motivation_modulation_genetic(this, no_genetic_modulation)
Produce modulation of the primary motivations, that result in the final motivation values (_finl)....
elemental subroutine motivation_modulation_absent(this)
Produce modulation of the primary motivations, that result in the final motivation values (_finl)....
elemental subroutine perception_component_motivation_init_zero(this)
Initialise perception components for a motivation state object.
elemental subroutine state_fear_defence_zero(this)
Init and cleanup fear state motivation object. The only difference from the base root STATE_MOTIVATIO...
real(srp) function predation_capture_probability_risk_wrapper(this, is_freezing)
Calculate the overall direct predation risk for the agent, i.e. the probability of attack and capture...
pure subroutine percept_predator_set_attack_rate_vector(this, attack_rate)
Set an array of the attack rates for the predator perception object.
elemental subroutine percept_memory_food_mean_dist_split(this, window, split_val, older, newer)
Get the average distance to food items per single time step within the perceptual memory stack,...
elemental real(srp) function motivation_max_perception_calc(this)
Calculate maximum value of the perception components across all motivations.
elemental real(srp) function state_motivation_motivation_get(this)
Standard "get" function for the root state, get the overall final motivation value (after modulation)...
subroutine percept_age_update_current(this, current)
Set and update the current age perception value.
elemental real(srp) function emotional_memory_arousal_mean(this, last)
Get the average value of the GOS arousal within the whole emotional memory stack.
elemental integer function perception_conspecifics_below_calculate(this)
Calculate the number of conspecifics in the perception object that are located below the actor agent.
elemental real(srp) function perception_food_dist_above_calculate(this)
Calculate the average distance to all food items in the current perception object that are above the ...
subroutine stomach_perception_get_object(this)
Get the stomach capacity perception objects into the individual PERCEPTION object layer.
CONDITION defines the physical condition of the agent
REPRODUCTION type defines parameters of the reproduction system.
Definition of a single food item. Food item is a spatial object that has specific location in space....
Definition of the super-type FOOD resource type. This is a superclass, several sub-classes can be def...
Definition of the PREDATOR objects. Predator is a moving agent that hunts on the evolving AHA agents ...
Definition of a spatial object. Spatial object determines the position of the agent,...
The appraisal level. At this level, perception objects are feed into the commondata::gamma2gene() sig...
This type defines a single conspecific perception component. It is required for the the_neurobio::per...
Global organismic state (GOS) level. GOS is defined by the dominant motivational state component (STA...
Individual motivation/emotion memory stack, a memory component that saves the values of the final mot...
Individual perception memory(history) stack, a memory component that saves perception values at previ...
Motivation is a collection of all internal motivational states of the agent. This type is also used i...
This type defines how the agent perceives its own age in terms of the model discrete time step.
This type defines how the agent perceives its own body mass it can be important for state-dependency.
Perceptual components of motivational states. Plugged into all STATE_, attention etc....
This type defines how the agent perceives conspecifics.
Perception of the current depth horizon.
This type defines how the agent perceives its own energy reserves it can be important for state-depen...
This type defines how the agent perceives food items. The food perception object the_neurobio::percep...
Perception of the ambient illumination. This is a very simple perception component,...
This type defines how the agent perceives a predator.
Perception of the reproductive factor, reproductive factor depends on the sex hormones differently in...
This type defines how the agent perceives its own stomach capacity.
The perception architecture of the agent. See "The perception mechanism" for a general overview....
This type defines a single spatial perception component, i.e. some single elementary spatial object t...
This type defines a single arbitrary spatial object perception component. For example,...
The state of fear state. Evokes active escape, fleeing, emigration and habitat switch.
The motivational state of hunger. Evokes food seeking, eating, higher activity, emigrating and habita...
These types describe the neurobiological states of the agent. (1) Each state may have several compone...
The state of reproduction. Evokes seeking conspecifics and mating during the reproductive phase.