Python optimization solver