Ñò
Ì ÆWc        
   @   s{   d  d k  l Z d  d k l Z d  d k l Z d  d k l Z d  d k Z	 d  d k
 Z
 d  d k Z d d d „  ƒ  YZ d S(	   iÿÿÿÿ(   t   Agent_TA(   t   Agent_EV(   t   Matrice(   t
   ParametresNt   Marche_travailc           B   s}   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   t
   parametres(   t   selfR   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   __init__   s    c   	      C   sÆ   t  | ƒ } t  | ƒ } t | | ƒ } x˜ t | i ƒ D]‡ } x~ t | i ƒ D]m } |  i i d j o! t i d d ƒ | i	 | | <qM t i ƒ  } t
 | t |  i i ƒ ƒ | i	 | | <qM Wq7 W| S(   Ng      à?i    i   (   t   lenR   t   ranget   mt   nR   t   proba_matrice_TEt   randomt   randintt   datat   intt   float(	   R   t   liste_agents_EVt   liste_agents_TAR
   R   t
   matrice_TEt   it   jt   r(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   creer_matrice_TE   s      !/c         C   s8   g  } x+ t  t | ƒ ƒ D] } | i | | ƒ q W| S(   N(   R	   R   t   append(   R   R   t#   liste_salaires_effectifs_precedentet   liste_salaires_indicatifsR   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   creer_liste_salaires_indicatifs   s
     c         C   s@   t  | ƒ } t | t | ƒ ƒ } t | d d „  d t ƒ} | S(   Nt   cmpc         S   s   t  |  d  | d  ƒ S(   i    (   R   (   t   xt   y(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   <lambda>,   s    t   reverse(   R   t   zipR	   t   sortedt   True(   R   R   t   Jt   liste_sal_indicet   couples_salaire_entreprise(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt"   obtenir_couples_salaire_entreprise'   s    c         C   sÆ  |  i  | ƒ } t | ƒ } g  } x— t | i ƒ D]† } x} t | ƒ D]o } | | d d  j p | | d d j o? d | i | | | d <| d j o | i | | ƒ q³ qD qD Wq1 Wx+ t t | ƒ ƒ D] } | i | | ƒ qÎ Wt | ƒ } xÊ t | i ƒ D]¹ } g  }	 xA t | ƒ D]3 } | i | | d j o |	 i | | ƒ qqWt |	 ƒ }
 |
 d j oP |	 d d |	 |
 d d |  i i	 j o! d | i | | |
 d d <q¾qqW| S(   Ni    i   (
   R(   R   R	   R
   t   NoneR   R   t   removeR   t   param_coupure(   R   R   R   R'   t   Lt   couples_a_supprimerR   R   t   ct$   couples_salaire_entreprise_connecteet   l(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt"   couper_lien_travailleur_entreprise/   s6      *!   +)c         C   s”   g  } x‡ t  | i ƒ D]v } d } xZ t  | i ƒ D]I } | | d  j o2 | | d j o! | | | | i | | 7} q2 q2 W| i | ƒ q W| S(   Ni    (   R	   R
   R   R)   R   R   (   R   R   R   t#   liste_somme_salaires_indic_employesR   t   somme_salairesR   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt)   creer_liste_somme_salaires_indic_employesO   s      "%c   
      C   sÇ   g  } xº t  | i ƒ D]© } g  } x t  | i ƒ D]| } | | d j oR | | d  j oA | | d j o0 | | | i | | | | | | i }	 n d }	 | i |	 ƒ q2 W| i | ƒ q W| S(   Ni    (   R	   R
   R   R)   R   t   heuresR   (
   R   R   R   R   R2   t   repartition_heures_travailleursR   t   liste_repartition_heuresR   t   heures_travaillees(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   repartir_heures[   s      30c         C   si   g  } x\ t  t | ƒ ƒ D]H } d } x, t  t | ƒ ƒ D] } | | | | 7} q8 W| i | ƒ q W| S(   Ni    (   R	   R   R   (   R   R6   R   R   t   liste_total_heuresR   t   total_heuresR   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   obtenir_liste_total_heuresj   s      c         C   sQ   g  } xD t  t | ƒ ƒ D]0 } | | i |  i | | ƒ } | i | ƒ q W| S(   N(   R	   R   t   convertir_heures_biensR   R   (   R   R   R:   t   liste_production_entreprisesR   t
   production(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt"   creer_liste_production_entreprisesu   s     c   	      C   s˜   g  } x‹ t  t | ƒ ƒ D]w } | | d j oM | | i |  i i | | } | | | | | | i } | i | ƒ q d  } | i | ƒ q W| S(   Ni    (   R	   R   t   cashR   t   prct_invest_emploit   gammaR   R)   (	   R   R   R:   R   R   t   liste_salaires_effectifsR   t   salt   salaire_effectif(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   creer_liste_salaires_effectifs~   s     c         C   sÈ   g  } d } x¯ t  t | ƒ ƒ D]› } d } xu t  t | ƒ ƒ D]a }	 | |	 d  j oJ | | |	 | |	 }
 | |
 7} | | i |
 7_ | |	 i |
 8_ q> q> W| | 7} | i | ƒ q W| | f S(   Ni    (   R	   R   R)   RA   R   (   R   R   R   R6   RD   t   liste_payes_totales_employest   somme_payes_totales_employesR   t   paye_totaleR   t   paye(    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   payer_employesŒ   s      

c         C   s¿   t  | ƒ } |  i i g | } |  i | | ƒ } |  i | | | | ƒ }	 |  i |	 | | ƒ }
 |  i | |
 ƒ } |  i | |
 | | ƒ } |  i | | |	 | ƒ \ } } | | |	 |
 | | | f S(   N(	   R   R   t   salaire_initialR4   R9   R<   R@   RG   RL   (   R   R   R   R   R   R   R%   R   R2   R6   R:   R>   RD   RH   RI   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   initialiser_marche_travail¥   s    c         C   sÄ   |  i  | | ƒ } |  i | | ƒ } |  i | | ƒ } |  i | | | | ƒ } |  i | | | ƒ }	 |  i | |	 ƒ }
 |  i | |	 | | ƒ } |  i | | | | ƒ \ } } | | | |	 |
 | | f S(   N(   R   R1   R4   R9   R<   R@   RG   RL   (   R   R   R   R   R   R   R   R2   R6   R:   R>   RD   RH   RI   (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt
   travailler´   s    (   t   __name__t
   __module__R   R   R   R(   R1   R4   R9   R<   R@   RG   RL   RN   RO   (    (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyR   
   s   						 								(    (   t   agenttaR    t   agentevR   t   matriceR   R   R   t   numpyt   npR   t   osR   (    (    (    s.   /home/kaufmanl/SIMU/Migrants1/marchetravail.pyt   <module>   s   