<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mobemu.algorithms;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import mobemu.node.Centrality;
import mobemu.node.Context;
import mobemu.node.Message;
import mobemu.node.Node;

/**
 * Class for an Adaptive Routing node.
 *
 * <NAME>, <NAME>, <NAME> and <NAME>.
 * A dynamic data routing solution for opportunistic networks. In Proceedings of
 * the 14th International Conference on Telecommunications, ConTEL 2017, pages
 * 83-90, Zagreb, Croatia, 2017. IEEE.
 *
 * @author Radu
 */
public class AdaptiveRouting extends Node {

    /**
     * Number of contacts with each node.
     */
    private int contactCount[];
    /**
     * Contact duration with each node.
     */
    private long contactTime[];
    /**
     * Number of contacts with any node.
     */
    private int anyContactCount = 0;
    /**
     * Contact duration with any node.
     */
    private long anyContactTime = 0;
    /**
     * Inter-contact time with each node.
     */
    private long interContactTime[];
    /**
     * Last contact time with each node.
     */
    private long lastContactTime[];
    /**
     * Inter-contact time with any node.
     */
    private long interAnyContactTime = 0;
    /**
     * Last contact time with any node.
     */
    private long lastAnyContactTime = 0;
    /**
     * Total number of nodes.
     */
    private int totalNodes = 0;
    /**
     * List of nodes.
     */
    private Node[] nodeList;
    /**
     * Random number generator.
     */
    private static Random RAND = null;
    /**
     * Maximum values of utility function parameters seen so far (used for
     * normalization).
     */
    private UtilityFunctionParams maxParams;
    /**
     * Initial weights for (in this order) similarity, centrality, friendship,
     * strength, trust.
     */
    double[] initialWeights = {0.05, 0.3, 0.5, 0.1, 0.05}; // UPB
    //double[] initialWeights = {0.05, 0.3, 0.3, 0.1, 0.25}; // Sigcomm
    /**
     * Algorithm version (1 - equal split, 2 - weighted split, 3 - equal
     * values).
     */
    private int version;
    /**
     * Default message exchange probability.
     */
    private double prob;
    /**
     * Difference between two nodes' parameters, in order for them to be
     * considered close enough.
     */
    private double closeness;
    /**
     * Set to {@code true} if a comparison should be performed between the
     * utility parameters of the two encountering nodes.
     */
    private boolean compare;
    /**
     * Set to {@code true} if the algorithm should use only default parameters.<commit_msg>Add Adaptive Routing params for HCMM<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mobemu.algorithms;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import mobemu.node.Centrality;
import mobemu.node.Context;
import mobemu.node.Message;
import mobemu.node.Node;

/**
 * Class for an Adaptive Routing node.
 *
 * <NAME>, <NAME>, <NAME> and <NAME>.
 * A dynamic data routing solution for opportunistic networks. In Proceedings of
 * the 14th International Conference on Telecommunications, ConTEL 2017, pages
 * 83-90, Zagreb, Croatia, 2017. IEEE.
 *
 * @author Radu
 */
public class AdaptiveRouting extends Node {

    /**
     * Number of contacts with each node.
     */
    private int contactCount[];
    /**
     * Contact duration with each node.
     */
    private long contactTime[];
    /**
     * Number of contacts with any node.
     */
    private int anyContactCount = 0;
    /**
     * Contact duration with any node.
     */
    private long anyContactTime = 0;
    /**
     * Inter-contact time with each node.
     */
    private long interContactTime[];
    /**
     * Last contact time with each node.
     */
    private long lastContactTime[];
    /**
     * Inter-contact time with any node.
     */
    private long interAnyContactTime = 0;
    /**
     * Last contact time with any node.
     */
    private long lastAnyContactTime = 0;
    /**
     * Total number of nodes.
     */
    private int totalNodes = 0;
    /**
     * List of nodes.
     */
    private Node[] nodeList;
    /**
     * Random number generator.
     */
    private static Random RAND = null;
    /**
     * Maximum values of utility function parameters seen so far (used for
     * normalization).
     */
    private UtilityFunctionParams maxParams;
    /**
     * Initial weights for (in this order) similarity, centrality, friendship,
     * strength, trust.
     */
    //double[] initialWeights = {0.05, 0.3, 0.5, 0.1, 0.05}; // UPB
    //double[] initialWeights = {0.05, 0.3, 0.3, 0.1, 0.25}; // Sigcomm
    double[] initialWeights = {0.2, 0.4, 0.1, 0.1, 0.2}; // HCMM
    /**
     * Algorithm version (1 - equal split, 2 - weighted split, 3 - equal
     * values).
     */
    private int version;
    /**
     * Default message exchange probability.
     */
    private double prob;
    /**
     * Difference between two nodes' parameters, in order for them to be
     * considered close enough.
     */
    private double closeness;
    /**
     * Set to {@code true} if a comparison should be performed between the
     * utility parameters of the two encountering nodes.
     */
    private boolean compare;
    /**
     * Set to {@code true} if the algorithm should use only default parameters.
{'fraction_non_alphanumeric': 0.10962007668177065, 'fraction_numerical': 0.017776228651097944, 'mean_word_length': 2.350262697022767, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5314096', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1630, 'n_words': 592}