Skip to content

Commit

Permalink
Merge branch 'master' into snyk-fix-bc0b399066957c51993baa095144bc52
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserfarouk authored Nov 4, 2023
2 parents 5e558a7 + 2bcb054 commit bcba1bc
Show file tree
Hide file tree
Showing 15 changed files with 544 additions and 358 deletions.
1 change: 1 addition & 0 deletions docs/requirements.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ sphinx-sizzle-theme
nbformat
nbsphinx
nb2plots
pillow>=10.0.0 # not directly required, pinned by Snyk to avoid a vulnerability
12 changes: 6 additions & 6 deletions negmas/genius/ginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
[("Kawaii", "agents.anac.y2015.fairy.kawaii")],
[
(
"AgentBuyong",
"AgentBuyog",
"agents.anac.y2015.agentBuyogV2.AgentBuyogMain",
)
],
Expand All @@ -298,7 +298,7 @@
[("Kawaii", "agents.anac.y2015.fairy.kawaii")],
[
(
"AgentBuyong",
"AgentBuyog",
"agents.anac.y2015.agentBuyogV2.AgentBuyogMain",
)
],
Expand Down Expand Up @@ -373,7 +373,6 @@
[("ClockworkAgent", "agents.anac.y2016.clockworkagent.ClockworkAgent")],
[("MaxOops", "agents.anac.y2016.maxoops.MaxOops")],
[("ParsAgent2", "agents.anac.y2016.pars2.ParsAgent2")],
[("ParsAgent", "agents.anac.y2016.parscat.ParsCat")],
[("SYAgent", "agents.anac.y2016.syagent.SYAgent")],
],
"linear": True,
Expand Down Expand Up @@ -454,7 +453,7 @@
"finalists": [
[("MengWan", "agents.anac.y2018.meng_wan.Agent36")],
[("IQSun2018", "agents.anac.y2018.iqson.IQSun2018")],
[("PonpokoRampage", "agents.anac.y2018.ponpokorampage.PonPokoRampage")],
[("PonPokoRampage", "agents.anac.y2018.ponpokorampage.PonPokoRampage")],
[("AgentHerb", "agents.anac.y2018.agentherb.AgentHerb")],
[("FullAgent", "agents.anac.y2018.fullagent.FullAgent")],
[("BetaOne", "agents.anac.y2018.beta_one.Group2")],
Expand Down Expand Up @@ -490,7 +489,7 @@
[("Sontag", "agents.anac.y2018.sontag.Sontag")],
[("Agent33", "agents.anac.y2018.agent33.Agent33")],
[("AgentNP1", "agents.anac.y2018.agentnp1.AgentNP1")],
[("ateamagent", "agents.anac.y2018.ateamagent.ATeamAgent")],
[("AteamAgent", "agents.anac.y2018.ateamagent.ATeamAgent")],
[("ExpRubick", "agents.anac.y2018.exp_rubick.Exp_Rubick")],
[("GroupY", "agents.anac.y2018.groupy.GroupY")],
[("Lancelot", "agents.anac.y2018.lancelot.Lancelot")],
Expand Down Expand Up @@ -1154,7 +1153,7 @@ def simplify_name(x: str):
special_names = dict(
AI2014Group2="agents.ai2014.group2.Group2",
Agent33="agents.anac.y2018.agent33.Agent33",
AgentBuyong="agents.anac.y2015.agentBuyogV2.AgentBuyogMain",
AgentBuyog="agents.anac.y2015.agentBuyogV2.AgentBuyogMain",
AgentF="agents.anac.y2017.agentf.AgentF",
AgentFSEGA="agents.anac.y2010.AgentFSEGA.AgentFSEGA",
AgentGG="agents.anac.y2019.agentgg.AgentGG",
Expand Down Expand Up @@ -1263,6 +1262,7 @@ def simplify_name(x: str):
PokerFace="agents.anac.y2015.pokerface.PokerFace",
PonPokoAgent="agents.anac.y2017.ponpokoagent.PonPokoAgent",
PonpokoRampage="agents.anac.y2018.ponpokorampage.PonPokoRampage",
PonPokoRampage="agents.anac.y2018.ponpokorampage.PonPokoRampage",
RandomDance="agents.anac.y2015.RandomDance.RandomDance",
Rubick="agents.anac.y2017.rubick.Rubick",
SACRA="agents.anac.y2019.sacra.SACRA",
Expand Down
54 changes: 38 additions & 16 deletions negmas/genius/gnegotiators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
from .negotiator import GeniusNegotiator

__all__ = [
"AgentBuyong",
"AgentBuyog",
"AgentF",
"AgentFSEGA",
"AgentGG",
"AgentGP",
"AgentH",
"AgentHP",
"AgentHP2",
"AgentHP2main",
"AgentHerb",
"AgentI",
"AgentK",
Expand All @@ -29,6 +28,9 @@
"AgentSmith2016",
"AgentTD",
"AgentTRP",
"Agent33",
"Agent36",
"ABMPAgent2",
"AgentW",
"AgentX",
"AgentYK",
Expand All @@ -37,6 +39,7 @@
"AresParty",
"ArisawaYaki",
"Aster",
"AteamAgent",
"Atlas",
"Atlas3",
"Atlas32016",
Expand Down Expand Up @@ -64,6 +67,7 @@
"FSEGA2019",
"Farma",
"Farma17",
"Farma2017",
"Flinch",
"FullAgent",
"FunctionalAcceptor",
Expand All @@ -72,6 +76,7 @@
"Gahboninho",
"Gangester",
"Gangster",
"GeneKing",
"GaravelAgent",
"Gin",
"GrandmaAgent",
Expand All @@ -88,6 +93,7 @@
"Group18",
"Group19",
"Group1BOA",
"PodAgent",
"TUDelftGroup2",
"Group20",
"Group21",
Expand Down Expand Up @@ -211,8 +217,12 @@ def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2018.beta_one.Group2"
super().__init__(**kwargs)

class Ateamagent(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2018.ateamagent.ATeamAgent"
super().__init__(**kwargs)

class ATeamAgent(GeniusNegotiator):
class AteamAgent(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2018.ateamagent.ATeamAgent"
super().__init__(**kwargs)
Expand All @@ -230,12 +240,6 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class AgentBuyogMain(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2015.agentBuyogV2.AgentBuyogMain"
super().__init__(**kwargs)


class AgentF(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2017.agentf.AgentF"
Expand All @@ -254,12 +258,6 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class AgentHP2main(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2016.agenthp2.AgentHP2_main"
super().__init__(**kwargs)


class AgentHerb(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2018.agentherb.AgentHerb"
Expand Down Expand Up @@ -708,6 +706,12 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class Group2(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2015.group2.Group2"
super().__init__(**kwargs)


class Y2015Group2(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2015.group2.Group2"
Expand Down Expand Up @@ -1096,7 +1100,7 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class AgentBuyong(GeniusNegotiator):
class AgentBuyog(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2015.agentBuyogV2.AgentBuyogMain"
super().__init__(**kwargs)
Expand Down Expand Up @@ -1150,6 +1154,12 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class Farma2017(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2017.farma.Farma17"
super().__init__(**kwargs)


class MyAgent(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2016.myagent.MyAgent"
Expand Down Expand Up @@ -1252,6 +1262,12 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class GeneKing(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2017.geneking.GeneKing"
super().__init__(**kwargs)


class Gravity(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2019.gravity.Gravity"
Expand Down Expand Up @@ -1288,6 +1304,12 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)


class PodAgent(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2019.podagent.Group1_BOA"
super().__init__(**kwargs)


class SACRA(GeniusNegotiator):
def __init__(self, **kwargs):
kwargs["java_class_name"] = "agents.anac.y2019.sacra.SACRA"
Expand Down
7 changes: 5 additions & 2 deletions negmas/genius/negotiator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from negmas import warnings
from negmas.gb.common import get_offer
from negmas.outcomes.base_issue import Issue
from negmas.outcomes.outcome_space import DiscreteCartesianOutcomeSpace

from ..common import MechanismState, NegotiatorMechanismInterface
from ..config import CONFIG_KEY_GENIUS_BRIDGE_JAR, negmas_config
Expand Down Expand Up @@ -319,9 +320,11 @@ def join(

self.java_uuid = self._create(nmi.n_negotiators)

if not isinstance(nmi.cartesian_outcome_space, CartesianOutcomeSpace):
if not isinstance(nmi.outcome_space, CartesianOutcomeSpace) and not isinstance(
nmi.outcome_space, DiscreteCartesianOutcomeSpace
):
raise ValueError(
f"Genius negotiators cannot be used with an out come space of type {nmi.cartesian_outcome_space.__class__.__name__}. Must use `CartesianOutcomeSpace`"
f"Genius negotiators cannot be used with an out come space of type {nmi.outcome_space.__class__.__name__}. Must use `CartesianOutcomeSpace/DiscreteCartesianOutcomeSpace`"
)
self.issues = nmi.cartesian_outcome_space.issues
self.issue_names = [_.name for _ in self.issues]
Expand Down
5 changes: 1 addition & 4 deletions negmas/helpers/logging.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/usr/bin/env python
"""
A set of utilities that can be used by agents developed for the platform.
This set of utlities can be extended but must be backward compatible for at
least two versions
A set of logging utility functions that can be used by agents developed for the platform.
"""
from __future__ import annotations

Expand Down
6 changes: 3 additions & 3 deletions negmas/inout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from random import shuffle
from typing import Any, Callable, Iterable, Sequence

from attrs import define
from attrs import define, field

from negmas.helpers.inout import dump, load
from negmas.helpers.types import get_full_type_name
Expand Down Expand Up @@ -61,8 +61,8 @@ class Scenario:

agenda: CartesianOutcomeSpace
ufuns: tuple[UtilityFunction, ...]
mechanism_type: type[Mechanism] | None
mechanism_params: dict
mechanism_type: type[Mechanism] | None = None
mechanism_params: dict = field(factory=dict)

@property
def issues(self) -> tuple[Issue, ...]:
Expand Down
11 changes: 3 additions & 8 deletions negmas/preferences/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,20 +1132,15 @@ def calc_outcome_optimality(
# assert 0 <= optim[name] <= 1, f"{name=}, {optim[name]=}"
for name, lst, diff in (
("max_welfare_optimality", stats.pareto_utils, dists.max_welfare),
# (
# "max_relative_welfare_optimality",
# stats.pareto_utils,
# dists.max_relative_welfare,
# ),
):
if not lst:
optim[name] = float("nan")
continue
if abs(max_dist) < 1e-12:
mx = max(sum(_) for _ in lst)
if abs(mx) < 1e-12:
optim[name] = float("nan")
continue
mx = max(sum(_) for _ in lst)
optim[name] = max(0, 1 - (mx - diff) / mx)
optim[name] = max(0, diff / mx)
assert 0 <= optim[name], f"{name=}, {optim[name]=}"
return OutcomeOptimality(**optim)

Expand Down
Loading

0 comments on commit bcba1bc

Please sign in to comment.