Exemplo n.º 1
0
def forceConnection():
	global network
	if network == None:
		
		theSVNVersion=get_svn_codec_version()
		theCodecVersion=get_codec_version()

		host = Network.kLocalHost
		port = Network.kDefaultPort

		hostString = os.getenv("RLGLUE_HOST")
		portString = os.getenv("RLGLUE_PORT")

		if (hostString != None):
			host = hostString

		try:
			port = int(portString)
		except TypeError:
			port = Network.kDefaultPort
		
		print "RL-Glue Python Experiment Codec Version: "+theCodecVersion+" (Build "+theSVNVersion+")"
		print "\tConnecting to " + host + " on port " + str(port) + "..."
		sys.stdout.flush()
		
		
		network = Network.Network()
		network.connect(host,port)
		network.clearSendBuffer()
		network.putInt(Network.kExperimentConnection)
		network.putInt(0)
		network.send()
def loadEnvironment(theEnvironment):
	theSVNVersion=get_svn_codec_version()
	theCodecVersion=get_codec_version()
	client = ClientEnvironment(theEnvironment)

	host = Network.kLocalHost
	port = Network.kDefaultPort

	hostString = os.getenv("RLGLUE_HOST")
	portString = os.getenv("RLGLUE_PORT")

	if (hostString != None):
		host = hostString

	try:
		port = int(portString)
	except TypeError:
		port = Network.kDefaultPort

	print("RL-Glue Python Environment Codec Version: "+theCodecVersion+" (Build "+theSVNVersion+")")
	print("\tConnecting to " + host + " on port " + str(port) + "...")
	sys.stdout.flush()

	client.connect(host, port, Network.kRetryTimeout)
	print("\t Environment Codec Connected")

	client.runEnvironmentEventLoop()
	client.close()
Exemplo n.º 3
0
def forceConnection():
	global network
	if network == None:
		
		theSVNVersion=get_svn_codec_version()
		theCodecVersion=get_codec_version()

		host = Network.kLocalHost
		port = Network.kDefaultPort

		hostString = os.getenv("RLGLUE_HOST")
		portString = os.getenv("RLGLUE_PORT")

		if (hostString != None):
			host = hostString

		try:
			port = int(portString)
		except TypeError:
			port = Network.kDefaultPort
		
		print "RL-Glue Python Experiment Codec Version: "+theCodecVersion+" (Build "+theSVNVersion+")"
		print "\tConnecting to " + host + " on port " + str(port) + "..."
		sys.stdout.flush()
		
		
		network = Network.Network()
		network.connect(host,port)
		network.clearSendBuffer()
		network.putInt(Network.kExperimentConnection)
		network.putInt(0)
		network.send()
Exemplo n.º 4
0
def loadEnvironment(theEnvironment):
    theSVNVersion = get_svn_codec_version()
    theCodecVersion = get_codec_version()
    client = ClientEnvironment(theEnvironment)

    host = Network.kLocalHost
    port = Network.kDefaultPort

    hostString = os.getenv("RLGLUE_HOST")
    portString = os.getenv("RLGLUE_PORT")

    if (hostString != None):
        host = hostString

    try:
        port = int(portString)
    except TypeError:
        port = Network.kDefaultPort

    print "RL-Glue Python Environment Codec Version: " + theCodecVersion + " (Build " + theSVNVersion + ")"
    print "\tConnecting to " + host + " on port " + str(port) + "..."
    sys.stdout.flush()

    client.connect(host, port, Network.kRetryTimeout)
    print "\t Environment Codec Connected"

    client.runEnvironmentEventLoop()
    client.close()
def loadEnvironment(theEnvironment):
	theSVNVersion=get_svn_codec_version()
	theCodecVersion=get_codec_version()
	client = ClientEnvironment(theEnvironment)

	host = Network.kLocalHost
	port = Network.kDefaultPort

	hostString = os.getenv("RLGLUE_HOST")
	portString = os.getenv("RLGLUE_PORT")

	if (hostString != None):
		host = hostString

	try:
		port = int(portString)
	except TypeError:
		port = Network.kDefaultPort

	print ("RL-Glue Python Environment Codec Version: "+theCodecVersion+" (Build "+theSVNVersion+")")
	# BEGIN: change made by: Akshay Narayan (05-01-2015:2244)
	print ("Number of objectives/rewards:" + Reward.getNumRewards())
	# END: change made by: Akshay Narayan (05-01-2015:2244)
	print ("\tConnecting to " + host + " on port " + str(port) + "...")
	sys.stdout.flush()

	client.connect(host, port, Network.kRetryTimeout)
	print ("\t Environment Codec Connected")

	client.runEnvironmentEventLoop()
	client.close()