Simulation with AnyLogic/Agent-Based Modeling/Step 3. Adding Adoption from Advertisement

''' Step 3. Adding Adoption from Advertisement '''

In this model the volume of advertising and the probability that a potential adopter will adopt as the result of exposure to a given amount of advertising are assumed to be constant each period. So, we will use a parameter to model the advertising effectiveness — the fractional adoption rate from advertising.

We will create this parameter in the Person class. Since all agents are represented by objects of this active object class, they have the same characteristics we define here. Optionally, you can define characteristics individually for each agent by altering values of parameters for some agents.

Define the advertising suggestibility of the person


 * 1) Open the Person class diagram
 * 2) Drag the Parameter [[File:Step_3._Adding_Adoption_from_Advertisement1.gif‎]] element from the General page of the Palette view onto the diagram.
 * 3) On the General page of the Properties view, set up the parameter properties.
 * 4) Change the name of the parameter. Type  in the Name edit box.
 * 5) In the Default Value edit box, type . [[File:Step_3._Adding_Adoption_from_Advertisement2.png‎]]

Now we will define the behavior of our agent using a statechart.

Create a statechart


 * 1) Draw the following statechart: [[File:Step_3._Adding_Adoption_from_Advertisement3.png‎]]
 * 2) First, draw a state. Drag the State [[File:Step_3._Adding_Adoption_from_Advertisement4.gif]] element from the Statechart page of the Palette view onto the diagram.
 * 3) Resize it by dragging the state borders. Change its Name to PotentialAdopter. [[File:Step_3._Adding_Adoption_from_Advertisement5.png]]
 * 4) Add statechart entry pointer pointing to this state as shown on the figure below. Drag the Statechart Entry Point [[File:Step_3._Adding_Adoption_from_Advertisement6.gif]] element from the Statechart page of the Palette view into the graphical editor, so that its ending point got connected to the upper border of the state: [[File:Step_3._Adding_Adoption_from_Advertisement7.png]]
 * 5) Now PotentialAdopter is an initial state of the statechart, since the atatechart entry pointer points to it. The person remains a potential adopter until this state is active.
 * 6) Add one more state below the created one. You can simply drag the PotentialAdopter state with Ctrl button pressed. This will create a copy of the state. Name this state Adopter. The person becomes an adopter, when this state becomes active. [[File:Step_3._Adding_Adoption_from_Advertisement8.png]]
 * 7) Add a transition going from the PotentialAdopter state to the Adopter state. Drag the Transition [[File:Step_3._Adding_Adoption_from_Advertisement9.gif]] element from the Statechart page of the Palette view onto the diagram of active object class, so that the starting point of the transition got connected to the lower border of PotentialAdopter state.
 * 8) Drag the ending point of the transition onto a border of Adopter state. The transition should look like in the figure below: [[File:Step_3._Adding_Adoption_from_Advertisement3.png‎]]
 * 9) This transition models the product purchase by this person. The time needed to come to a conclusion to buy the product depends on the person’s advertising suggestibility exponentially. So, set up that this transition will be taken with AdEffectiveness rate. Go to the General page of the transition's Properties view and choose Rate from the Triggered by drop-down list. Type  in the Rate field below. You can use the code completion assistant when typing the parameter name. Type only the first letters of the name and then press Ctrl+space. This will open the assistant dialog listing parameters, variables and functions of your model. Scroll to the AdEffectiveness parameter and insert its name by double-clicking on it. [[File:Step_3._Adding_Adoption_from_Advertisement10.png]]