コード例 #1
0
void env_cleanup()
{
	freeRLStructPointer(emptyObservation);
	freeRLStructPointer(nonEmptyObservation);
	if(responseMessage!=0){
		free(responseMessage);
		responseMessage=0;
	}
}
コード例 #2
0
ファイル: test_empty_agent.c プロジェクト: IvanLogvinov/soar
void agent_cleanup() {
	freeRLStructPointer(emptyAction);
	freeRLStructPointer(nonEmptyAction);
	emptyAction=0;
	nonEmptyAction=0;
	if(responseMessage!=0){
		free(responseMessage);
		responseMessage=0;
	}
}
コード例 #3
0
/**
 * Pass off the call to env_step
 */
JNIEXPORT void JNICALL Java_org_rlcommunity_rlviz_environmentshell_JNIEnvironment_JNIenvstep(JNIEnv *env, jobject obj, jintArray intArray, jdoubleArray doubleArray, jcharArray charArray) {
    //create a new action to pass in from the 4 parameters. This is needed because the actual Java object cannot be passed in,
    //so the data from the object is passed in, then put into the C equivalent of an action

    jsize numInts,numDoubles,numChars=0;
    numInts = env->GetArrayLength(intArray);
    numDoubles = env->GetArrayLength(doubleArray);
    numChars = env->GetArrayLength(charArray);

    action_t* theAction = allocateRLStructPointer(numInts, numDoubles, numChars);
    //    action_t a;
    //    a.numInts = numInts;
    //    a.intArray = (int*) malloc(sizeof (int) * a.numInts);
    //    a.numDoubles = numDoubles;
    //    a.doubleArray = (double*) malloc(sizeof (double) * a.numDoubles);
    //    a.numChars = numChars;
    //    a.charArray = (char*) malloc(sizeof (char) * a.numChars);
    env->GetIntArrayRegion(intArray, 0, numInts, (jint*) theAction->intArray);
    env->GetDoubleArrayRegion(doubleArray, 0, numDoubles, (jdouble*) theAction->doubleArray);
    env->GetCharArrayRegion(charArray, 0, numChars, (jchar*) theAction->charArray);

    // get the return from env_step and parse it into a form that java can check.
    rewardObs = envFuncPointers.env_step(theAction);
    freeRLStructPointer(theAction);
    sharedReturnVariable = (observation_t *) rewardObs->observation;
}
コード例 #4
0
void env_cleanup() {
	int envState = kEnvCleanup;

	rlBufferClear(&theBuffer);
	rlSendBufferData(rlGetEnvironmentConnection(), &theBuffer, envState);

	rlBufferClear(&theBuffer);
	rlRecvBufferData(rlGetEnvironmentConnection(), &theBuffer, &envState);
	assert(envState == kEnvCleanup);

	rlBufferDestroy(&theBuffer);

	freeRLStructPointer(theObservation);
	theObservation=0;
	
	if (theTaskSpec != 0) {
		free(theTaskSpec);
		theTaskSpec = 0;
	}

	if (theOutMessage != 0) {
		free(theOutMessage);
		theOutMessage = 0;
	}
}
コード例 #5
0
ファイル: test_1_agent.c プロジェクト: SuFizz/RL-project
void agent_cleanup() {
	freeRLStructPointer(action);
	action=0;
	if(responseMessage!=0){
		free(responseMessage);
		responseMessage=0;
	}
}
コード例 #6
0
ファイル: test_1_agent.c プロジェクト: SuFizz/RL-project
const action_t *agent_step(const double reward, const observation_t *o) {
	__RL_CHECK_STRUCT(o);
	stepCount++;

	freeRLStructPointer(action);
	action=duplicateRLStructToPointer(o);
	__RL_CHECK_STRUCT(action)
	return action;
}
コード例 #7
0
void env_cleanup()
{
	if(responseMessage!=0){
		free(responseMessage);
		responseMessage=0;
	}
	freeRLStructPointer(theObservation);
	theObservation=0;
}
コード例 #8
0
ファイル: SampleSarsaAgent.c プロジェクト: zydeon/rl-comp2014
void agent_cleanup() {
	clearRLStruct(&this_action);
	clearRLStruct(&last_action);
	freeRLStructPointer(last_observation);
	
	if(value_function!=0){
		free(value_function);
		value_function=0;
	}
}
コード例 #9
0
ファイル: RL_server_agent.c プロジェクト: Gmallory3/rl-glue
/* Tell the agent that we're cleaning up */
void agent_cleanup() {
	int agentState = kAgentCleanup;

	rlBufferClear(&theBuffer);
	rlSendBufferData(rlGetAgentConnection(), &theBuffer, agentState);

	rlBufferClear(&theBuffer);
	rlRecvBufferData(rlGetAgentConnection(), &theBuffer, &agentState);
	assert(agentState == kAgentCleanup);

        rlBufferDestroy(&theBuffer);
	
	freeRLStructPointer(globalAction);
	globalAction=0;

	if (theOutMessage != 0) {
	  free(theOutMessage);
	  theOutMessage = 0;
	}
}