Skip to content

Instantly share code, notes, and snippets.

@fchauvel
fchauvel / EAS-0
Created March 11, 2017 10:50
A minimal model of emergent auto scaling
#!/usr/bin/env python
from copy import deepcopy
import matplotlib.pyplot as plt
class ServerFactory:
def __init__(self, service_time, budget, living_cost, margin, reproduction_cost):
self._service_time = service_time
@fchauvel
fchauvel / search_rotation.py
Created January 18, 2017 09:13
Search for a sequence of 3-cell long circular rotations that can sort a permutation
#!/usr/bin/env python
from itertools import permutations
def find_rotations(array):
"""
Search for a sequence of rotations that would sort the given array
"""
goal = tuple(sorted(array))