replicahq / doppelganger

A Python package of tools to support population synthesizers
Apache License 2.0
165 stars 32 forks source link

Broadcast error in list balancer #7

Closed katbusch closed 7 years ago

katbusch commented 7 years ago
Error in puma 03706
Traceback (most recent call last):
  File "scripts/generate_all_pumas.py", line 123, in generate_population
    marginals, households, persons)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 73, in from_cleaned_data
    HouseholdAllocator._allocate_households(households, persons, marginals)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 147, in _allocate_households
    hh_table, A, B, w_extend, gamma * mu_extend.T, meta_gamma
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/listbalancer.py", line 168, in balance_multi_cvx
    weights_out = np.insert(weights_out, zero_marginals, zero_weights, 0)
  File "/home/kat/.local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 4910, in insert
    new[slobj] = values
ValueError: could not broadcast input array from shape (1,4) into shape (1,799)
katbusch commented 7 years ago

And another

Error in puma 03720
Traceback (most recent call last):
  File "scripts/generate_all_pumas.py", line 123, in generate_population
    marginals, households, persons)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 73, in from_cleaned_data
    HouseholdAllocator._allocate_households(households, persons, marginals)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 147, in _allocate_households
    hh_table, A, B, w_extend, gamma * mu_extend.T, meta_gamma
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/listbalancer.py", line 168, in balance_multi_cvx
    weights_out = np.insert(weights_out, zero_marginals, zero_weights, 0)
  File "/home/kat/.local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 4937, in insert
    old_mask[indices] = False
IndexError: index 29 is out of bounds for axis 1 with size 29
katbusch commented 7 years ago

And one is still not converging:

Error in puma 03713
Traceback (most recent call last):
  File "scripts/generate_all_pumas.py", line 123, in generate_population
    marginals, households, persons)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 73, in from_cleaned_data
    HouseholdAllocator._allocate_households(households, persons, marginals)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 154, in _allocate_households
    discretized_hh_weights = discretize_multi_weights(hh_table, hh_weights)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/listbalancer.py", line 225, in discretize_multi_weights
    prob.solve(verbose=verbose_solver)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/problem.py", line 210, in solve
    return self._solve(*args, **kwargs)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/problem.py", line 336, in _solve
    self._update_problem_state(results_dict, sym_data, solver)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/problem.py", line 448, in _update_problem_state
    "Solver '%s' failed. Try another solver." % solver.name())
katbusch commented 7 years ago

Looks like we're getting another broadcast error, eg in PUMA 03701:

Traceback (most recent call last):
  File "scripts/generate_all_pumas.py", line 123, in generate_population
    marginals, households, persons)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 73, in from_cleaned_data
    HouseholdAllocator._allocate_households(households, persons, marginals)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 147, in _allocate_households
    hh_table, A, B, w_extend, gamma * mu_extend.T, meta_gamma
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/listbalancer.py", line 180, in balance_multi_cvx
    np.zeros((n_controls, 1)), axis=1)
  File "/home/kat/.local/lib/python2.7/site-packages/numpy/lib/function_base.py", line 4856, in insert
    arr[...] = values
ValueError: could not broadcast input array from shape (4,1) into shape ()
katbusch commented 7 years ago

And only one PUMA (00101) is seeing this issue:

Traceback (most recent call last):
  File "scripts/generate_all_pumas.py", line 123, in generate_population
    marginals, households, persons)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 73, in from_cleaned_data
    HouseholdAllocator._allocate_households(households, persons, marginals)
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/allocation.py", line 147, in _allocate_households
    hh_table, A, B, w_extend, gamma * mu_extend.T, meta_gamma
  File "/home/kat/.local/lib/python2.7/site-packages/doppelganger/listbalancer.py", line 143, in balance_multi_cvx
    prob.solve(verbose=verbose_solver)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/problem.py", line 210, in solve
    return self._solve(*args, **kwargs)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/problem.py", line 332, in _solve
    kwargs)
  File "/home/kat/.local/lib/python2.7/site-packages/cvxpy/problems/solvers/ecos_intf.py", line 126, in solve
    **solver_opts)
  File "/home/kat/.local/lib/python2.7/site-packages/ecos.py", line 62, in solve
    return _ecos.csolve((m,n1,p), c, data, indices, colptr, h, dims, A.data, A.indices, A.indptr, b, **kwargs)
RuntimeError: Internal problem occurred in ECOS while setting up the problem.
Please send a bug report with data to Alexander Domahidi.
Email: domahidi@control.ee.ethz.ch