Commit 02cb7518 authored by Matthew Hausknecht's avatar Matthew Hausknecht

Redesigned the port allocation arguments.

parent 231a5252
...@@ -33,8 +33,8 @@ class Trainer(object): ...@@ -33,8 +33,8 @@ class Trainer(object):
""" """
def __init__(self, args, rng=numpy.random.RandomState()): def __init__(self, args, rng=numpy.random.RandomState()):
self._rng = rng # The Random Number Generator self._rng = rng # The Random Number Generator
self._serverPort = args.basePort # The port the server is listening on self._serverPort = args.port + 1 # The port the server is listening on
self._coachPort = args.basePort + 1 # The coach port to talk with the server self._coachPort = args.port + 2 # The coach port to talk with the server
self._logDir = args.logDir # Directory to store logs self._logDir = args.logDir # Directory to store logs
self._numOffense = args.numOffense # Number offensive players self._numOffense = args.numOffense # Number offensive players
self._numDefense = args.numDefense # Number defensive players self._numDefense = args.numDefense # Number defensive players
...@@ -66,7 +66,7 @@ class Trainer(object): ...@@ -66,7 +66,7 @@ class Trainer(object):
self._agentTeam = '' # Name of the team the agent is playing for self._agentTeam = '' # Name of the team the agent is playing for
self._agentNumInt = -1 # Agent's internal team number self._agentNumInt = -1 # Agent's internal team number
self._agentNumExt = -1 # Agent's external team number self._agentNumExt = -1 # Agent's external team number
self._agentServerPort = args.basePort + 8 # Port for agent's server self._agentServerPort = args.port # Port for agent's server
# =============== MISC =============== # # =============== MISC =============== #
self._offenseTeam = '' # Name of the offensive team self._offenseTeam = '' # Name of the offensive team
self._defenseTeam = '' # Name of the defensive team self._defenseTeam = '' # Name of the defensive team
......
...@@ -43,9 +43,9 @@ def main(args, team1='left', team2='right', rng=numpy.random.RandomState()): ...@@ -43,9 +43,9 @@ def main(args, team1='left', team2='right', rng=numpy.random.RandomState()):
if not os.path.exists(args.logDir): if not os.path.exists(args.logDir):
os.makedirs(args.logDir) os.makedirs(args.logDir)
binary_dir = os.path.dirname(os.path.realpath(__file__)) binary_dir = os.path.dirname(os.path.realpath(__file__))
server_port = args.basePort server_port = args.port + 1
coach_port = args.basePort + 1 coach_port = args.port + 2
olcoach_port = args.basePort + 2 olcoach_port = args.port + 3
serverOptions = ' server::port=%i server::coach_port=%i ' \ serverOptions = ' server::port=%i server::coach_port=%i ' \
'server::olcoach_port=%i server::coach=1 ' \ 'server::olcoach_port=%i server::coach=1 ' \
'server::game_log_dir=%s server::text_log_dir=%s' \ 'server::game_log_dir=%s server::text_log_dir=%s' \
...@@ -108,9 +108,9 @@ def parseArgs(args=None): ...@@ -108,9 +108,9 @@ def parseArgs(args=None):
help='Don\'t use a learning agent.') help='Don\'t use a learning agent.')
p.add_argument('--no-sync', dest='sync', action='store_false', default=True, p.add_argument('--no-sync', dest='sync', action='store_false', default=True,
help='Run server in non-sync mode') help='Run server in non-sync mode')
p.add_argument('--base-port', dest='basePort', type=int, default=6000, p.add_argument('--port', dest='port', type=int, default=6000,
help='Base port for communications. rcssserver will use this \ help='Agent server\'s port. rcssserver, coach, and ol_coach'\
port and all other ports will be allocated incrementally.') ' will be incrementally allocated the following ports.')
p.add_argument('--log-dir', dest='logDir', default='log/', p.add_argument('--log-dir', dest='logDir', default='log/',
help='Directory to store logs.') help='Directory to store logs.')
return p.parse_args(args=args) return p.parse_args(args=args)
......
...@@ -117,10 +117,11 @@ void error(const char *msg) ...@@ -117,10 +117,11 @@ void error(const char *msg)
#define ADD_NORM_FEATURE(val, min_val, max_val) \ #define ADD_NORM_FEATURE(val, min_val, max_val) \
assert(featIndx < numFeatures); \ assert(featIndx < numFeatures); \
if (val < min_val || val > max_val) { std::cout << "Violated Feature Bounds: " << val << " Expected min/max: [" << min_val << ", " << max_val << "]" << std::endl;} \ if (val < min_val || val > max_val) { std::cout << "Violated Feature Bounds: " << val << " Expected min/max: [" << min_val << ", " << max_val << "]" << std::endl;} \
assert(val >= min_val); \
assert(val <= max_val); \
feature_vec[featIndx++] = ((val - min_val) / (max_val - min_val)) \ feature_vec[featIndx++] = ((val - min_val) / (max_val - min_val)) \
* (FEAT_MAX - FEAT_MIN) + FEAT_MIN; * (FEAT_MAX - FEAT_MIN) + FEAT_MIN;
// assert(val >= min_val); \
// assert(val <= max_val); \
#define LOG_FEATURE(val) \ #define LOG_FEATURE(val) \
if (val <= min_feat_val) \ if (val <= min_feat_val) \
......
...@@ -107,7 +107,7 @@ protected: ...@@ -107,7 +107,7 @@ protected:
const static float observedSelfSpeedMax = 0.46; const static float observedSelfSpeedMax = 0.46;
const static float observedPlayerSpeedMax = 0.75; const static float observedPlayerSpeedMax = 0.75;
const static float observedStaminaMax = 8000.; const static float observedStaminaMax = 8000.;
const static float observedBallSpeedMax = 3.0; const static float observedBallSpeedMax = 5.0;
float maxHFORadius; // Maximum possible distance in HFO playable region float maxHFORadius; // Maximum possible distance in HFO playable region
// Useful measures defined by the Server Parameters // Useful measures defined by the Server Parameters
float pitchLength, pitchWidth, pitchHalfLength, pitchHalfWidth, float pitchLength, pitchWidth, pitchHalfLength, pitchHalfWidth,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment