12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #! /usr/bin/env python3
-
- import math
- import numpy as np
- import pandas as pd
-
- class Populations:
- """
- This class is made of a pd.Series of the clients and the operation that
- can be made on the population.
- """
- def __init__(self, carac):
- """
- Population constructor, initialises the client population with
- the caracterictic given to it.
- """
- self.population = pd.Series()
- self.nmbr = carac
- self.add_client(self.nmbr)
- """
- We have to define more caracteristics. We will start with a
- simple serie of inds and their number
- """
- return
-
- def add_client(self, nb):#Need to add an arg "habits"
- """
- Add 'nb' clients to the population.
- """
- start = len(self.population)
- end = start + nb
- inds = []
- for i in range(nb):
- inds.append(Individu())
- self.population = self.population.append(pd.Series(inds, index=range(start, end)))
- self.nmbr += nb
- return
-
-
- class Individu: #tout OK
- """
- This class define the clients, it's caracteristics being :
- - User habits :
- - The habits with the Magna Wallet and the 3 tokens :
- -self.magna_wallet_btc
- -self.magna_wallet_eth
- -self.magna_wallet_mgn
- They containe statisctical law of the user habits.
- The methods of this class operate on only one client.
- """
-
- def __init__(self):#OK
- """
- Constructeur d'une instance 'individu'.
- Ce constructeur fait appel aux fonction especes et aleatoire
- pour initialisé les variables d'un individu aux valeurs propres
- à son espèce.
- """
- # Those 3 caracteristic are the users habits concerning the client
- # use of Magna Wallet
- self.magna_wallet_btc = (
- np.random.normal(
- loc=0.00001, scale=0.002),
- abs(np.random.normal(
- loc=0.002, scale=0.01))
- )
- self.magna_wallet_eth = (
- np.random.normal(
- loc=0.01, scale=0.9),
- abs(np.random.normal(
- loc=0.5, scale=5))
- )
- self.magna_wallet_mgn = (
- np.random.normal(
- loc=1, scale=10),
- abs(np.random.normal(
- loc=10, scale=50))
- )
- return
|