private void sarsa(int reward, Weights weights, double x_i[], double[] x_ip1)
	{
		// Set some local variables.
		double[] w = weights.getWeights();
		double wx = 0.0f;
		double sig = 0.0f;

		// Compute y_i.
		double wxp1 = 0.0f;
		for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++) wxp1 += w[j] * x_ip1[j];
		double sigp1 = sigmoid(wxp1);
		double y_i = reward + gamma * sigp1;

		// Print out some debug if needed.
		if (PRINT_DEBUG)
		{
			System.out.println("SARSA Weights:");
			weights.printWeights();
		}

		// For each feature, compute the dot product of w and x.
		for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++) wx += w[j] * x_i[j];
		if (PRINT_DEBUG)
			System.out.println("\twx: " + wx);

		// Compute the sigmoid of this.
		sig = sigmoid(wx);
		if (PRINT_DEBUG)
			System.out.println("\tsigmoid(wx): " + sig);

		// Weight vector update.
		for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++)
			w[j] = w[j] + eta * ((y_i - sig) * (sig) * (1 - sig) * x_i[j]);

		// Set the new weights.
		weights.setWeights(w);
		if (PRINT_DEBUG)
		{
			System.out.println("SARSA New Weights:");
			weights.printWeights();
		}
	}