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 fe3f92e commit e476c96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mango_library/negotiation/winzent/winzent_base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,10 @@ async def solve(self):
return
self.governor.solver_triggered = True
logger.debug(f"{self.aid} starts solver now.")
final, afforded_values, initial_req = self.governor.try_balance()
try:
final, afforded_values, initial_req = self.governor.try_balance()
except Exception as e:
logger.debug(f"EXCEPTION: {e}")
if final:
logger.debug(f"{self.aid} found solution.")
await self.answer_requirements(final, afforded_values, initial_req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,15 @@ def solve(self, power_balance, initiator):
print("no offers received. Aborting solution process")
return {}, None, None
self.initial_requirement = PowerBalanceSolverStrategy.find_initial_requirement(power_balance, initiator)
print("initial requirement done")
# if all the available offers cannot satisfy the need for this timeslot,
# no special solving strategy is needed since all will be accepted anyway
# in this case, there are more offers than needed to satisfy the initial requirement
most_ethical_requirements = deepcopy(power_balance)
most_ethical_requirements.ledger[self.start_time].remove(self.initial_requirement)
print("removed initial req")
most_ethical_requirements.ledger[self.start_time].sort(key=get_ethics_score_from_req, reverse=True)
print("reqs sorted")
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):
Expand Down

0 comments on commit e476c96

Please sign in to comment.