U() public method

public U ( double p_lower, double p_upper ) : double
p_lower double
p_upper double
return double
Beispiel #1
0
    /// <summary>
    /// Generate DeltaP the change vector to be added to old P.
    /// It contains randomly activated slots.
    /// Not all parameters will thus be changed by this vector.
    /// </summary>
    /// <param name="p_P"></param>
    /// <returns></returns>
    private List <double> getDeltaP(List <float> p_P)
    {
        int size = p_P.Count;
        // Get R value
        double Pmax = 0.0f, Pmin = 0.0f;
        //getMaxMinOfList(p_P, out Pmin, out Pmax);
        double r = 40.0f;

        r    = Random.Range(0.0f, 40.0f);
        Pmax = r; Pmin = -r;
        double R = Pmax - Pmin;
        //Debug.Log("R: " + R + " Pmax: " + Pmax + " Pmin: " + Pmin);

        // Get S vector
        List <float> S = getS(size);

        // Calculate delta-P
        double[] deltaP = new double[size];
        for (int i = 0; i < size; i++)
        {
            double P = (double)p_P[i];
            double c = m_uniformDistribution.U(P - 0.1 * R, P + 0.1 * R);
            deltaP[i] = (double)S[i] * c;
        }
        return(new List <double>(deltaP));
    }
Beispiel #2
0
    /// <summary>
    /// Generate DeltaP the change vector to be added to old P.
    /// It contains randomly activated slots.
    /// Not all parameters will thus be changed by this vector.
    /// </summary>
    /// <param name="p_P"></param>
    /// <returns></returns>
    private List <double> getDeltaP(List <float> p_P, List <float> p_Pmin, List <float> p_Pmax, int p_iteration)
    {
        int size = p_P.Count;

        // Get R value
        //double Pmax = 1.0f, Pmin = -1.0f;


        //getMaxMinOfList(p_P, out Pmin, out Pmax);
        //double r = 0.001f;
        //if (p_iteration % 10 == 9) r = 0.1f;
        //r = Random.Range(0.0f, 1.0f);
        // Pmax = r; Pmin = -r;


        //double R = Pmax - Pmin;
        //Debug.Log("R: " + R + " Pmax: " + Pmax + " Pmin: " + Pmin);

        // Get S vector
        List <float> S = getS(size);

        // Calculate delta-P
        double[] deltaP = new double[size];
        for (int i = 0; i < size; i++)
        {
            double P = (double)p_P[i];
            double R = p_Pmax[i] - p_Pmin[i];
            double c = m_uniformDistribution.U(/*P*/ -0.1 * R, /*P +*/ 0.1 * R);

            deltaP[i] = (double)S[i] * c;
        }
        return(new List <double>(deltaP));
    }