probability which must be a 2D
array (number of observations resources which must contain an entry ``capacity''. This entry should
be a numpy array or list giving capacity of each alternative of the universe.
resources can contain an entry ``agent_units'' which is a 1D numpy array
or list giving for each agent the number of units to be removed from capacity
when placing this agent. Default value is 1 for each agent. resources
can also contain an entry ``index'' which is a 1 or 2D array of indices of
alternatives for each agent. If it is a 1D array, it is assumed to be the same
for all agents. If alternatives were previously sampled, it is the index of
the sampled alternatives within the universe. The shape of ``index'' should
correspond to the shape of probability or its second dimension if 1D.
If no ``index'' entry is given, it is created for all alternatives given by
``capacity'' and appended to resources.
The run() method invokes the opus_core module
random_choices_from_index which returns indices of agent's
choices made independently of one another. The indices are chosen
values from the entry ``index''. Using capacity, it is then
determined for which choices there is an overflow in agent's
interest. If there is no overflow the method simply returns the
obtained indices. Otherwise, from agents that selected choices with
overflow, a number that corresponds to the overflow is randomly
sampled. Those agents are marked for making a new choice. The
probability cells that correspond to the not available alternatives
are set to zero and the process is repeated. The maximum number of
iterations of this process can be controlled by the entry
``lottery_max_iterations'' in resources which is by default
3. If there is still overflow after reaching the maximum number of
iterations, in the resulting array there is a value -1 for agents
that couldn't find any choice.