Add optimizer.py and fill it with functions copied from calc_weights.py and data_prob.py