mango_library.negotiation.cohda

Module for distributed real power planning with COHDA. Contains roles, which integrate COHDA in the negotiation system and the core COHDA-decider together with its model.

class mango_library.negotiation.cohda.COHDA(weights, schedule_provider, is_local_acceptable, part_id)

COHDA-decider

decide(content: mango_library.negotiation.cohda.CohdaMessage)Tuple[mango_library.negotiation.cohda.WorkingMemory, mango_library.negotiation.cohda.WorkingMemory]

Execute the COHDA decision process.

Parameters

content – the incoming COHDA message

Returns

old and new working memory

objective_function(candidate, target_schedule)

Objective function of COHDA. Calculates the negative sum of all deviations of the candidate to the target schedule

Parameters
  • candidate – candidate schedule

  • target_schedule – target schedule

Returns

negative sum of all deviations

class mango_library.negotiation.cohda.COHDARole(schedules_provider, weights, local_acceptable_func)

Negotiation role for COHDA.

create_cohda(part_id: int)

Create an instance of the COHDA-decider.

Parameters

part_id – participant id

Returns

COHDA

handle(message, assignment: mango_library.coalition.core.CoalitionAssignment, negotiation: mango_library.negotiation.core.Negotiation, meta: Dict[str, Any])

Handle the message and execute the specific negotiation step.

Parameters
  • message – the message

  • assignment – the assignment the negotiations is in

  • negotiation – the negotiation model

  • meta – meta data

class mango_library.negotiation.cohda.CohdaMessage(working_memory: mango_library.negotiation.cohda.WorkingMemory)

Message for a COHDa negotiation. Contains the current working memory of an agent.

property working_memory: mango_library.negotiation.cohda.WorkingMemory

Return the working memory of the sender agent

Returns

the working memory of the sender

class mango_library.negotiation.cohda.CohdaNegotiationStarterRole(target_schedule, coalition_model_matcher=None, coalition_uuid=None)

Convenience role for starting a COHDA negotiation with simply providing a target schedule

class mango_library.negotiation.cohda.ScheduleSelection(schedule: numpy.array, counter: int)

A selection of a specific schedule

property counter: int

The counter of the selection

Returns

the counter

property schedule: numpy.array

The schedule as np.array

Returns

scheduke

class mango_library.negotiation.cohda.SolutionCandidate(agent_id: int, candidate: Dict[int, numpy.array])

Model for a solution candidate in COHDA.

property agent_id: str

Return the agent id

Returns

agent id

property candidate: Dict[int, numpy.array]

Return the candidate schedule map (part_id -> schedule)

Returns

map part_id -> schedule

class mango_library.negotiation.cohda.WorkingMemory(target_schedule, system_config: Dict[str, mango_library.negotiation.cohda.ScheduleSelection], solution_candidate: mango_library.negotiation.cohda.SolutionCandidate)

Working memory of a COHDA agent

property solution_candidate: mango_library.negotiation.cohda.SolutionCandidate

The current best known solution candidate for the planning

Returns

the solution candidate

property system_config: Dict[str, mango_library.negotiation.cohda.ScheduleSelection]

Return the system config as map part_id -> selection

Returns

the believed system state

property target_schedule

Return the target schedule

Returns

the target schedule