Reparation
- create_agent_capacity_constraint(agt_name: str, remaining_capacity, footprint_func: Callable[[str], float], bin_vars: Dict[Tuple, BinaryVariable]) RelationProtocol
Create a constraints that ensure that an agent a_m does not exceeds its capacity when hosting some candidates computations x_i in X_c.
The constraints is an hard constraint that return an ‘high enough’ (10 000) value when it is not satisfied.
- Parameters:
agt_name (str) – the name of the agent a_m for which we are creating the constraint
remaining_capacity – the remaining capacity of a_m before hosting any candidate computation from X_c.
footprint_func (function) – a function that gives the footprint for a computation, given its name.
bin_vars (a dictionary { (comp_name, agt_name) -> BinaryVariable }) – containing the k binary variable x_i^m, one for each of the k candidate computations x_i that could be hosted on the agent a_m.
- Return type:
a Constraint object
- create_agent_comp_comm_constraint(agt_name: str, candidate_name: str, candidate_info: Tuple[List[str], Dict[str, str], Dict[str, List[str]]], comm: Callable[[str, str, str], float], bin_vars: Dict[Tuple, BinaryVariable]) RelationProtocol
Create a constraints that returns the communication costs for agent a_m agt_name when hosting a candidate computations x_i in X_c. The constraints is an soft constraint that should be minimized.
- Parameters:
agt_name (str) –
candidate_info –
comm (Callable) – function (comp_name, neigh_comp, neigh_agt) -> float that returns the communication cost between the computation comp_name hosted on the current agt_name agent and it’s neighbor computation neigh_comp hosted on neigh_agt.
bin_vars (Dict[Tuple, BinaryVariable]) – a dict containing one binary variable for each par (x_i, a_m) where x_i is a candidate computation or a neighbor of a candidate computation and a_m is an agent that can host x_i.
- Return type:
A Constraint object
- create_agent_hosting_constraint(agt_name: str, hosting_func: Callable[[str], float], bin_vars: Dict[Tuple, BinaryVariable]) RelationProtocol
Create a constraints that returns the hosting costs for agent a_m agt_name when hosting some candidates computations x_i in X_c.
The constraints is an soft constraint that should be minimized.
- Parameters:
agt_name (str) – the name of the agent a_m.
hosting_func (Callable) – a function that gives the hosting costs for a computation x_i on a_m, given the name of x_i.
bin_vars (dictionary { (comp_name, agt_name) -> BinaryVariable }) – containing the k binary variable x_i^m, one for each of the k candidate computations x_i that could be hosted on the agent a_m.
- Return type:
a Constraint object
- create_computation_hosted_constraint(computation_name: str, bin_vars: Dict[Tuple, BinaryVariable]) RelationProtocol
Create a constraints that the computation names computation_name is hosted exactly once on a set of n candidate agents. The constraints is an hard constraint that return an ‘high enough’ (10 000) value when it is not satisfied.
- Parameters:
computation_name – the name of the computation
bin_vars – a dictionary { (comp_name, agt_name) -> BinaryVariable } containing the n binary variables x_i^m, one for each of the n
candidate agents a_m the computation x_i could be hosted on
- Returns:
a constraint object