Ejemplo n.º 1
0
def divide_smaller_for_agent(allocation, from_index, to_index, number_of_agents):
    agent_fair_value = numbersUtils.current_split_allocation_value(
        allocation, allocation.fromIndex, allocation.toIndex, number_of_agents
    )
    agent_to_index = numbersUtils.cut_index(allocation.values, agent_fair_value, from_index, allocation.toIndex)

    allocation.fromIndex = from_index
    allocation.toIndex = agent_to_index

    return allocation
Ejemplo n.º 2
0
def check_division_for_agent(allocation, from_index, to_index, number_of_agents):
    agent_fair_value = numbersUtils.current_split_allocation_value(
        allocation, allocation.fromIndex, allocation.toIndex, number_of_agents
    )
    current_allocation_value = allocation.values_sum(from_index, to_index)
    # numbersUtils.division_sum(allocation.values, from_index, to_index)

    if agent_fair_value >= current_allocation_value:
        return None
    else:
        return divide_smaller_for_agent(allocation, from_index, to_index, number_of_agents)