---
# System prepended metadata

title: BERG - ACA research

---

# BERG - ACA research
 
 - [ ] przypomnienie sobie jak zaimplementowano temperatury w repo
 - [ ] wyjęcie sampla grafów (do prototypowania)
 - [ ] wytestowanie temperatury - samego mechanizmu
 - [ ] temperatura krytyczna - jaka jest? [średnia magnetyzacja i ciepło właściwe]
 - [ ] ustalenie scenariuszy annealingu [post na BK iota.cafe](https://iota.cafe/t/annealing-cellular-automaton-consensus/271) + wyjście poza temperaturę krytyczną
 - [ ] nie zmieniamy opinii jeśli otoczenie inne
 - [ ] badanie
 
 
 
 Hej!
 
 Referencje [Ising Model]:
  - EN model Isinga - wprowadzenie: https://ps.uci.edu/~cyu/p238C/LectureNotes/IsingModel/IsingModel.pdf
  - PL rozdział o modelu Isinga i przejściach fazowych: wysłany na Slack jako zip
  - PL wyznaczanie temperatury krytycznej (sieci o rozładzie potęgowym): http://efizyka.if.pw.edu.pl/twiki/pub/FSiT/ProjektyQuiz/TomaszBaldyga.pdf
  - EN Ising model on evolution networks and its application on opinion formation https://doi.org/10.1088/1674-1056/23/6/068701
  - Artykuł teoretyczny z obliczeniami temperatury krytycznej dla grafów k-regularnych https://arxiv.org/abs/1701.08628
  - Deep learning for critical temp: https://d-nb.info/1225346274/34
  - Phase Transitions and Hysteresis in a Cellular Automata-Based Model of Opinion Formation http://efizyka.if.pw.edu.pl/twiki/pub/MFwEiS/LiteraturaPrzedmiotu/Kacperski_Holyst_1996.pdf
  - A comparative study of 2d Ising model at different boundary conditions using non-deterministic Hexagonal Cellular Automata https://arxiv.org/pdf/1906.04794.pdf


PSEUDOKOD ALGORYTMU
  WEJŚCIE
   - macierz adjacencji grafu, spiny [-1/1 lub 0/1], temperatura układu
  
  WYJŚCIE
   - średnia magnetyzacja po każdej iteracji
  
  ALGORYTM


```
Variables
Graphs - set of precomputed graphs 
steps_till_termalization - number of simulation steps required for the graph to reach "equilibrium state". We will need to find it numerically
sample_max - number of data samples collected for a single graph
steps_till_weak_corelations - number of simulation steps untill graph states are weakly correlated
t_max - maximal vale of analysed temperatures i.e., we look for t_c in range [0,t_max]


----
list_of_av_op - list of values of average opinion for a fixed graph and fixed temperature. Different values in this list correspond to different snapshots in time
list_of_en    - same as above, but energy
    
list_of_av_values_of_av_op  - list of values of average value of 'average opinion' i.e., mean value of the list 'list_of_av_op'
list_of_st_dev_of_en - same as above, but *energy* and *standard deviation*

```

```
Functions:
append(list,element) - appends value of 'element' to 'list'
MAXIMAL_VALE - returns max value from a list
make_histogram    - returns histogram (empirical density function)
calculate_average - returns average value of elements from the list
calculate_st_deviation - returns standard deviation
evolve_to_next_step(g,t) - graph 'g' is evolved to the mext step with synchronous Glauber dynamics ar temperature 't' 
FIND_CORRESPONDING_POSITION(list,element) - returns relative position of element 'element' in the 'list'


```

            
  ```       
  PROGRAM Main
  
  DO g in Graphs
      tmp = calculate_tc(g)
      list_of_tc = append(list_of_tc; tmp)
  ENDDO
  
  PRINT(histogram.txt) make_histogram(list_of_tc)
  PRINT(results_txt) calculate_average(list_of_tc)
  PRINT(results.txt) calculate_st_deviation(list_of_tc)
```

```
PROGRAM calculate_tc(g)

list_of_av_values_of_av_op = {}
list_of_st_dev_of_en = {}

DO t_int = 0,t_max_int

    t = t_max*(t_int/t_max_int)
    
    DO step = 1, steps_till_termalization
        evolve_to_next_step(g,t)
    ENDDO

    list_of_av_op = {}
    list_of_en    = {}
    
    DO i = 1,sample_max
        DO step = 1, steps_till_weak_corelations
            evolve_to_next_step(g,t)
        ENDDO
        tmp_av_op = calculate_average_opinion(g)
        tmp_en   = calculate_energy(g)
        list_of_av_op = append(list_of_av_op; tmp_av_op)
        list_of_en = append(list_of_en; tmp_en)
    ENDDO
    
    tmp_av_av_op  = calculate_average(list_of_av_op)
    tmp_st_dev    = calculate_st_deviation(list_of_en)
    
    list_of_av_values_of_av_op = append(list_of_av_values_of_av_op ; tmp_av_av_op)
    list_of_st_dev_of_en = append(list_of_st_dev_of_en; tmp_st_dev)
    
    PRINT(av_opinion.txt)        t, tmp_av_av_op
    PRINT(heat_capacity.txt)     t, tmp_st_dev
    
ENDDO

Max_energy_st_dev = MAXIMAL_VALE(list_of_st_dev_of_en)


t_c = FIND_CORRESPONDING_POSITION(Max_energy_st_dev, list_of_st_dev_of_en) *(t_max/t_max_int)

RETURN t_c

```


 - ustalamy k i bierzemy różne n
 - wyliczyć temp krytyczną dla różnych kombinacji k, n i stworzyć histogram