model

model preview image

1 collaborator

Default-person ifelab lerma (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 65 times • Downloaded 0 times • Run 0 times
Download the 'model' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

Globals [delta-richesse payback old-richesse besoin scenario proba-FIN-LARGE-BI proba-FIN-FAIBLE-BI proba-DEP-BI ]
breed [Consommateurs Consommateur]
breed [Banques banque]
Consommateurs-own [segment revenu consommation richesse dette placement depot-IC depot-IB financement-IB financement-IC]
Banques-own [nature gains depots capital cash financement qualité prix conformité proximité]

to setup
  
  clear-all
  
  reset-ticks
  
  create-banques 1

  [
    Set Nature "I"
    set capital 200000
    Set depots 0
    Set cash capital 
    Set gains 0
    Set financement 0
    Set qualité Quality-IB
    Set prix Price-IB
    Set conformité 1
    hide-turtle
  ]

  create-banques 1

  [
    Set Nature "C"
    set capital 200000
    Set depots 0
    Set cash capital 
    Set gains 0
    Set financement 0
    Set qualité Quality-CB
    Set prix Price-CB
    Set conformité 0
    hide-turtle
  ]
  
  
create-consommateurs #customers
[
set shape "square"
set color white
setxy random-xcor random-ycor
]


Set proba-FIN-FAIBLE-BI round ( 100 * exp (0.592 * Price-IB + 1.162 * Compliance-IB + 0.466 * Proximity-IB + 0.431 * Quality-IB) / (exp (0.592 * Price-IB + 1.162 * Compliance-IB + 0.466 * Proximity-IB + 0.431 * Quality-IB) + exp (0.592 * Price-CB - 1.162 + 0.466 * Proximity-CB + 0.431 * Quality-CB) ) )

Set proba-FIN-LARGE-BI round ( 100 * exp (0.998 * Price-IB + 1.004 * Compliance-IB + 0.361 * Proximity-IB + 0.431 * Quality-IB) / (exp (0.998 * Price-IB + 1.004 * Compliance-IB + 0.361 * Proximity-IB + 0.431 * Quality-IB) + exp (0.998 * Price-CB - 1.004 + 0.361 * Proximity-CB + 0.431 * Quality-CB) ) )

Set proba-DEP-BI round ( 100 * exp (0.422 * Price-IB + 0.939 * Compliance-IB + 0.480 * Proximity-IB + 0.428 * Quality-IB) / (exp (0.422 * Price-IB + 0.939 * Compliance-IB + 0.480 * Proximity-IB + 0.428 * Quality-IB) + exp (0.422 * Price-CB - 0.939 + 0.480 * Proximity-CB + 0.428 * Quality-CB)))
end 

To Go
  
 while [ticks < 200] 
 [
  
  set delta-richesse 0
  
  Set payback 0
      
  Ask consommateurs 
  [
    
  set color white
  
  set revenu round random-normal Average-income SD-income
  
  set consommation round random-normal Average-spending SD-spending
  
  Set delta-richesse revenu - consommation
    
  ifelse (revenu - consommation) > 0
  
  [
  
   ifelse (  dette > 0 )
  
   [
  
     ifelse ( (revenu - consommation) >= dette )
            
     [
       
       
    Ifelse ( random 101 < proba-DEP-BI)  [ set color 55 ] [ set color RED ] ;; dessine des agents sous forme de carrés colorés
      
                  
       set scenario "A"
       set payback dette
       set dette 0
       set richesse richesse +  (revenu - consommation)
   
     ]
     
          
     [
     
       set scenario "B"
       set payback (revenu - consommation)
       set dette dette - (revenu - consommation)
       set richesse richesse +  (revenu - consommation)
     ]
     
     
   ] 
       
       
  [ ;; cas ou il n'y a pas de dette
    
    
    ifelse  random 101 < proba-DEP-BI [   set color 55  ] [ set color RED ]
    
    
    set scenario "C"
    set richesse richesse +  (revenu - consommation)
  ]
  
  
  
  ]
  
  
  [ ;; cas ou la consommation depasse le revenu
    
    ifelse ( richesse < consommation - revenu )
        
    [
    
  Let binary random 2 ;; variable temporaire 
   
 IFELSE   random 101 < (binary * proba-FIN-FAIBLE-BI + binary * proba-FIN-LARGE-BI) [ set color 51 ] [ set color pink ] ;; dessine des agents sous forme de carrés colorés
  
       
    
      ifelse richesse > 0
    
      [
      set scenario "D"
      set old-richesse richesse
      set besoin consommation - revenu - richesse
      set richesse richesse +  (revenu - consommation)
      set dette dette + besoin
      ]
    
      
      [
      set scenario "F"
      set besoin consommation - revenu
      set richesse richesse +  (revenu - consommation)
      set dette dette + besoin
      ]  
      
    ]
    
    [
      set scenario "E"
      set richesse richesse +  (revenu - consommation)
    ]
  ]
     
    
 IFELSE   random 101 < proba-DEP-BI  ;; fonction de décision pour les dépots
             
    [
   
      
       ask banques with [Nature = "I"]
        
    [
      IF scenario = "A"
   
      [
      set depots depots + delta-richesse - payback
      
      Set cash cash + delta-richesse - payback
      
      ]
      
            
    IF scenario = "C" or scenario = "E"
   
    [
      set depots depots + delta-richesse
      
      Set cash cash + delta-richesse
      
      ]  
     
     
     IF scenario = "D"
   
    [
           set depots depots - old-richesse
          
           Set cash cash - old-richesse
      ]
    
        
    ]
    
    ]
          
  
  [
      

       
      ask banques with [Nature = "C"]
    
    
    [
      IF scenario = "A"
   
      [
      set depots depots + delta-richesse - payback
      Set cash cash + delta-richesse - payback
      
      ]
      
      
    IF scenario = "C" or scenario = "E"
   
    [
      set depots depots + delta-richesse
    
      Set cash cash + delta-richesse
      
      ]  
     
     IF scenario = "D"
   
    [
           set depots depots - old-richesse
           
           Set cash cash - old-richesse

      ]
    
   
    ]
     
 
  ]
  
 Let binary random 2 ;; variable temporaire 
   
 IFELSE   random 101 < (binary * proba-FIN-FAIBLE-BI + binary * proba-FIN-LARGE-BI) ;; fonction de décision pour les financements
               
    [

      
       ask banques with [Nature = "I"]
      
    
    [
      IF scenario = "A"
   
      [
     
      set financement financement - payback
      
      set cash cash + payback
      
      ]
      
    
    IF scenario = "B"
   
    [
           set financement financement - payback
           set cash cash + payback
           
      ]
      
 
     
     IF scenario = "D"
   
    [

           set financement financement + besoin
           set cash cash - besoin
      ]
    
     IF scenario = "F"
   
    [
             set financement financement + besoin
             set cash cash - besoin
             
      ]
    
    ]
    
    ]
          
  
  [
      
       
      ask banques with [Nature = "C"]
          
    [
      IF scenario = "A"
   
      [

      
      set financement financement - payback
      set cash cash + payback
      ]
      
    
    IF scenario = "B"
   
    [
           set financement financement - payback
           set cash cash + payback
      ]
      
    
     
     IF scenario = "D"
   
    [

           set financement financement + besoin
           set cash cash - besoin
      ]
    
    IF scenario = "F"
   
    [
             set financement financement + besoin
             set cash cash - besoin
      ]
    
    ]
       
  
  ]
  
  
    ]
  
  tick 
  
  ]
 
End 

There is only one version of this model, created 9 months ago by ifelab lerma.

Attached files

File Type Description Last updated
model.png preview Preview for 'model' 9 months ago, by ifelab lerma Download

This model does not have any ancestors.

This model does not have any descendants.