JNegmasGateway

class negmas.java.JNegmasGateway[source]

Bases: object

Attributes Summary

DEFAULT_JAVA_PORT

DEFAULT_PYTHON_PORT

gateway

Methods Summary

connect([java_port, python_port, …])

connects to jnegmas

is_running(port)

Checks whether a JNegMAS Bridge is running.

shutdown()

start_java_side([path, java_port])

Initializes a connection to jnegmas

Attributes Documentation

DEFAULT_JAVA_PORT = 25333
DEFAULT_PYTHON_PORT = 25334
gateway: Optional[Union[py4j.java_gateway.JavaGateway, py4j.clientserver.ClientServer]] = None

Methods Documentation

classmethod connect(java_port: Optional[int] = None, python_port: Optional[int] = None, auto_load_java: bool = False, client_server: bool = True)bool[source]

connects to jnegmas

classmethod is_running(port)[source]

Checks whether a JNegMAS Bridge is running. This bridge is needed to use any objects in the jnegmas package

Remarks:

You can start a JNegMAS Bridge in at least two ways:

  • execute the python function init_jnegmas_bridge() in this module

  • run “negmas jnegmas” on the terminal

classmethod shutdown()[source]
classmethod start_java_side(path: Optional[str] = None, java_port: int = 0)None[source]

Initializes a connection to jnegmas

Examples

# >>> start_java_side(port=35337) # >>> a = JNegmasGateway.do_nothing_manager() # >>> a.java_uuid.startswith(‘jnegmas’) # True # >>> len(a.java_uuid)- len(a.java_class_name) == 36 # length of UUID # True