<commit_before>package eu.cassandra.sim.math.response;

import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

import org.bson.types.ObjectId;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoException;

import eu.cassandra.server.mongo.MongoPricingPolicy;
import eu.cassandra.sim.PricingPolicy;
import eu.cassandra.sim.math.Gaussian;
import eu.cassandra.sim.math.Histogram;
import eu.cassandra.sim.math.ProbabilityDistribution;
import eu.cassandra.sim.utilities.Constants;

public class Response {
	
	private static final int SHIFTING_WINDOW_IN_MINUTES = 60;
	private static final double SMALL_NUMBER = 0.0000001;
	
	public static ProbabilityDistribution respond(ProbabilityDistribution pd, 
			PricingPolicy policy, 
			PricingPolicy baseline, 
			double awareness, 
			double sensitivity, 
			String responseType) {
			double w = 10;
			double[] previousHist = pd.getHistogram();
			double[] newHist = new double[Constants.MIN_IN_DAY];
			double[] policyArr = policy.getTOUArray();
			double[] baseArr = baseline.getTOUArray();
			switch(responseType) {
				case "None":
					return pd;
				case "Optimal":
					newHist = shiftingOptimal(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;
				case "Normal":
					newHist = shiftingNormal(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;
				case "Discrete":
					newHist = shiftingDiscrete(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;<commit_msg>Change resposen weight<commit_after>package eu.cassandra.sim.math.response;

import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

import org.bson.types.ObjectId;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoException;

import eu.cassandra.server.mongo.MongoPricingPolicy;
import eu.cassandra.sim.PricingPolicy;
import eu.cassandra.sim.math.Gaussian;
import eu.cassandra.sim.math.Histogram;
import eu.cassandra.sim.math.ProbabilityDistribution;
import eu.cassandra.sim.utilities.Constants;

public class Response {
	
	private static final int SHIFTING_WINDOW_IN_MINUTES = 60;
	private static final double SMALL_NUMBER = 0.0000001;
	
	public static ProbabilityDistribution respond(ProbabilityDistribution pd, 
			PricingPolicy policy, 
			PricingPolicy baseline, 
			double awareness, 
			double sensitivity, 
			String responseType) {
			double w = 2;
			double[] previousHist = pd.getHistogram();
			double[] newHist = new double[Constants.MIN_IN_DAY];
			double[] policyArr = policy.getTOUArray();
			double[] baseArr = baseline.getTOUArray();
			switch(responseType) {
				case "None":
					return pd;
				case "Optimal":
					newHist = shiftingOptimal(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;
				case "Normal":
					newHist = shiftingNormal(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;
				case "Discrete":
					newHist = shiftingDiscrete(previousHist, baseArr, policyArr, w * awareness, w * sensitivity);
					break;
{'fraction_non_alphanumeric': 0.09829545454545455, 'fraction_numerical': 0.006534090909090909, 'mean_word_length': 4.725203252032521, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1783104', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1085, 'n_words': 253}