Skip to content

Commit

Permalink
added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteUniOldenburg committed Mar 28, 2024
1 parent bf9784a commit fe3f92e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mango_library/negotiation/winzent/xboole/governor.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def power_balance_strategy(self, strategy):
self._power_balance_strategy = strategy

def try_balance(self):
print("try_balance running")
assert self._power_balance is not None
assert self._power_balance_strategy is not None
print("assertions done")
return self._power_balance_strategy.solve(
self._power_balance, xboole.InitiatingParty.Local)
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ def solve(self, power_balance, initiator):
:param power_balance: The replies for the negotiation.
:param initiator: The initiator for the boolean solver
"""
print("solve inside ethical solver running")
# in this case, the agent did not receive any offers and the only requirement in the power balance is
# his own. Consequently, no solution can be created.
if len(power_balance.ledger[self.start_time]) < 2:
print("no offers received. Aborting solution process")
return {}, None, None
self.initial_requirement = PowerBalanceSolverStrategy.find_initial_requirement(power_balance, initiator)
# if all the available offers cannot satisfy the need for this timeslot,
Expand All @@ -220,6 +222,7 @@ def solve(self, power_balance, initiator):
most_ethical_requirements.ledger[self.start_time].remove(self.initial_requirement)
most_ethical_requirements.ledger[self.start_time].sort(key=get_ethics_score_from_req, reverse=True)
time_span = self.initial_requirement.time_span
print("checking if all offers are of same time span")
if not are_all_offers_in_same_time_span(most_ethical_requirements):
most_ethical_requirements.ledger[self.start_time].append(self.initial_requirement)
return self.ethical_solution_algorithm(most_ethical_requirements, initiator)
Expand Down

0 comments on commit fe3f92e

Please sign in to comment.