[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Sun, 4 Apr 2004 12:49:07 +0000 (UTC) 
Subject:Does POP11 compiler check the program for semantic or only syntactic? 
From:f_j_54 
Volume-ID: 

IN THE NAME OF GOD

Hello.
I have written a simulation program by sim_agent, but when I compile it ,I
receive wonderful errors(mishap interrupted) as they have confused me. For
example, sometimes, I don't change any things and compile again and receive
mishap interrupted at another line but with the same column number (at or
before line â??line numberâ?? column 56(this number is fixed always)). I check
above lines of  it, each time but I have not perceive any special errors.
Also, FOR loop as the following form isn't run at my pop11 ! and I got
error:
for 1->i step i+1->i till i<k+1 do <action> endfor;
Then, I used " for i to k do <action> endfor;".
Of course, before mishap interrupted ,main windows and control panel are
opened.
Does POP11 compiler check the program  for semantic or only syntactic?
It may be necessary that you know my simulation includes 6 types of agents.
Preys (are fixed) and their protectors (are mover), predators (are mover and
have learning capability),control center of predators(fixed and out of
environment),control center of protectors (fixed and out of environment) and
base stations(fixed) as origin for protectors. Predators and protectors are
not at environment at first and are entered by their control centers (I have
created them by sim_setup_info, then I have removed them from all_agents
list and put them at related lists at their control centers). I have defined
a rulesystem for each agent and have supposed that their rulesets are run
sequentially. Two rulesets of predators have been shown at the end.
If it is possible, please help me.
Sincerely,
Jenab.

;;;check_predator_remain_at_environment_ruleset
define :ruleset check_predator_remain_at_environment_ruleset;
    [DLOCAL
        [prb_allrules=true] [prb_sortrules=false]
    ];

    RULE check_predator_reach_its_target
    ;;;This rule checks if predator has reached to its target
    [there is prey]
    [LVARS [distance_to_target=pre_distance_to_target(sim_myself)]
           [finish_distance=pre_finish_distance_prey(sim_myself)]]
    [WHERE distance_to_target<finish_distance]
    ==>
    [predator has reached to its target]
    [predator do not remain]
    [STOP]

    RULE check_predator_reach_another_prey
    ;;;This rule checks if predator has reached to another prey
    [there is prey]
    [LVARS [finish_distance=pre_finish_distance_prey(sim_myself)]]
    [DNprey is ?DNprey]  /*DNprey is distance of nearest prey*/
    [prey ?name ?DNprey ==]
    [WHERE DNprey<finish_distance]
    ==>
    [predator has reached to another prey ?name]
    [predator do not remain]
    [STOP]

    RULE check_predator_encounter_with_protector
    ;;;This rule checks if predator has encountered with a protector
    [now there is protector]
    [LVARS [finish_distance=pre_finish_distance_pro(sim_myself)]]
    [DNP is ?DNP]/*DNP is distance of nearest protector*/
    [WHERE DNP<finish_distance]
    ==>
    [predator has encountered with a protector]
    [predator do not remain]
    [STOP]

    RULE check_remain_of_life_time
    ;;;This rule checks if life time of predator has been terminated
    [LVARS RL]
    [POP11 mover_life_time(sim_myself)-mover_age(sim_myself)->RL;]
    [WHERE RL=0]
    ==>
    [predator do not remain]
    [STOP]

    RULE end_of_ruleset
    ;;;if any one of above rules is not run,this rule is run
    ==>
    [STOP]

enddefine;

;;;calculate_feelings_of_level2_ruleset

define :ruleset calculate_feeling_of_level2_ruleset;
    [DLOCAL
        [prb_allrules=true] [prb_sortrules=false]
    ];

    RULE check1_necessity_calculate_feeling_level2
    ;;;This rule checks the necessity for calculate feelings of level 2
    [predator is new]
    [NOT now there is protector]
    ==>
    [STOP]

    RULE check2_necessity_calculate_feeling_level2
    ;;;This rule checks the necessity for calculate feelings of level 2
    [NOT last time there was protector]
    [NOT now there is protector]
    ==>
    [STOP]

    RULE calculate_security_there_is_protector1
    ;;;This rule calculates security of the predator if there is protector
    ;;;and there is not any other predator at its field of view
    [now there is protector]
    [NOT there is predator]
    [LVARS AD_P sec]
    [sum of distances of protectors is ?sum_of_distances]
    [num of protectors is ?num]
    ==>
    [POP11 (sum_of_distances/num)->AD_P;
           (AD_P/num)->sec;]
    [security of predator is ?sec]

    RULE calculate_security_there_is_protector2
    ;;;This rule calculates security of the predator if there is protector
    ;;;and there is other predators at its field of view
    [now there is protector]
    [there is predator]
    [LVARS AD_P AD_H sec]
    [sum of distances of protectors is ?sum_of_distances_p]
    [num of protectors is ?num_p]  (*************************error
line*********************)
    [sum of distances of predators is ?sum_of_distances_h]
    [num of predators is ?num_h]
    ==>
    [POP11 (sum_of_distances_p/num_p)->AD_P;
           (sum_of_distances_h/num_h)->AD_H;
           (AD_P/num_p)+pre_gama(sim_myself)*(num_h/AD_H)->sec;]
    [security of predator is ?sec]

    RULE calculate_security_there_is_not_protector1
    ;;;This rule calculates security of the predator if there are not
protector
    ;;;and other predator at its field of view
    [NOT now there is protector]
    [NOT there is predator]
    [LVARS [r=mover_visual_range(sim_myself)] sec]
    ==>
    [POP11 r+1->sec;]
    [security of predator is ?sec]

    RULE calculate_security_there_is_not_protector2
    ;;;This rule calculates security of the predator if there is not
protector
    ;;;but there is other predator at its field of view
    [NOT now there is protector]
    [there is predator]
    [LVARS [r=mover_visual_range(sim_myself)] AD_H sec]
    [sum of distances of predators is ?sum_of_distances_h]
    [num of protectors is ?num_h]
    ==>
    [POP11 (sum_of_distances_h/num_h)->AD_H;
           r+1+pre_gama(sim_myself)*(num_h/AD_H)->sec;]
    [security of predator is ?sec]

    RULE calculate_ability1
    ;;;This rule calculates ability of predator when target of the predator
there isn't
    [LVARS [predator_control_data=sim_data(valof(pc))]
           [target_name=sim_name(mover_target(sim_myself))]]
    [INDATA ?predator_control_data [?target_name removed]]
    ==>
    [ability of predator is 0]

    RULE calculate_ability2
    ;;;This rule calculates ability of predator based on distance to its
target
    ;;;and remaining of its life
    [LVARS [predator_control_data=sim_data(valof(pc))]
           [target_name=sim_name(mover_target(sim_myself))]]
    [INDATA ?predator_control_data [NOT ?target_name removed]]
    ==>
    [LVARS [L=mover_life_time(sim_myself)] [A=mover_age(sim_myself)]
           [D=pre_distance_to_target(sim_myself)] RL ability]
    [POP11 (L-A)->RL;
           RL/D->ability;]
    [ability of predator is ?ability]

    RULE calculate_opportunity_there_is_not_prey
    ;;;This rule calculates hunting opportunity of predator if there is not
prey at
    ;;;its field of view
    [NOT there is prey]
    [LVARS [opportunity=0]]
    ==>
    [opportunity is ?opportunity]

    RULE calculate_opportunity_there_is_prey1
    ;;;This rule calculates hunting opportunity of predator if there is prey
at
    ;;;its field of view and target of predator isn't at environment
    [there is prey]
    [LVARS [predator_control_data=sim_data(valof(pc))]
           [target_name=sim_name(mover_target(sim_myself))]]
    [INDATA ?predator_control_data [?target_name removed]]
    [LVARS AD_prey opportunity [L=mover_life_time(sim_myself)]
[A=mover_age(sim_myself)] RL]
    [sum of distances of preys is ?sum_of_distances]
    [num of preys is ?num]
    ==>
    [POP11 (L-A)->RL;
           (sum_of_distances/num)->AD_prey;
           ((num*RL)/AD_prey)->opportunity;]
    [opportunity is ?opportunity]

    RULE calculate_opportunity_there_is_prey2
    ;;;This rule calculates hunting opportunity of predator if there is prey
at
    ;;;its field of view and target of predator is at environment still
    [there is prey]
    [LVARS [predator_control_data=sim_data(valof(pc))]
           [target_name=sim_name(mover_target(sim_myself))]]
    [INDATA ?predator_control_data [NOT ?target_name removed]]
    [LVARS AD_prey opportunity [L=mover_life_time(sim_myself)]
[A=mover_age(sim_myself)] RL]
    [num of preys without predator is ?npwp]
    [sum of distances of preys without predator is ?sod_npwp]
    ==>
    [POP11 (L-A)->RL;
           (sod_npwp/npwp)->AD_prey;
           ((npwp*RL)/AD_prey)->opportunity;]
    [opportunity is ?opportunity]

    RULE calculate_danger_there_is_protector
    ;;;This rule calculates danger if there is protector at
    ;;;its field of view
    [now there is protector]
    [LVARS AD_P danger]
    [sum of distances of protectors is ?sum_of_distances]
    [num of protectors is ?num]
    ==>
    [POP11 (sum_of_distances/num)->AD_P;
           (num/AD_P)->danger;]
    [danger is ?danger]

    RULE calculate_danger_there_is_not_protector
    ;;;This rule calculates danger if there is not protector at
    ;;;its field of view
    [NOT now there is protector]
    [LVARS [danger=0]]
    ==>
    [danger is ?danger]

    RULE end_calculate_feeling_of_level2
    ==>
    [STOP]

enddefine;