Пример #1
0
 def get_Score_Subarray(self, num_subarray):
     """
     Compute the score of a subarray 
     according to the difference between the constraints computed (res,mrs,elongation,sidelobe_percentage)
     and the 4 objective_constraints 
     and weighted according to the constraints_weights
     """
     list_objective_constraints = self.configuration_Manager.get_Objective_Constraints(
     )
     list_constraints_weights = self.configuration_Manager.get_Constraints_Weights(
     )
     baselines = ccs.calc_baselines(self, num_subarray)
     dec = self.configuration_Manager.get_Source_Declination()
     ha = self.configuration_Manager.get_Source_Hour_Angle()
     res, mrs, elongation, sidelobe_percentage = ccs.calc_constraints(
         ha, dec, baselines)
     score_subarray = 0.0
     score_subarray = list_constraints_weights[0][num_subarray] * abs(
         res - list_objective_constraints[0][num_subarray]
     ) / list_objective_constraints[0][
         num_subarray] + list_constraints_weights[1][num_subarray] * (
             list_objective_constraints[1][num_subarray] - mrs
         ) / list_objective_constraints[1][
             num_subarray] + list_constraints_weights[2][num_subarray] * (
                 elongation - list_objective_constraints[2][num_subarray]
             ) / list_objective_constraints[2][
                 num_subarray] + list_constraints_weights[3][
                     num_subarray] * (
                         sidelobe_percentage -
                         list_objective_constraints[3][num_subarray]
                     ) / list_objective_constraints[3][num_subarray]
     return score_subarray
Пример #2
0
    print '\n'
    print "----------------------------------------------------"
    print 'INITIAL RESULTS ' 
    best_init,pos=pop.get_Fittest()
    print "Best score = ", best_init.get_Score()
    print "Best array = "
    best_init.display_Array()
    print "----------------------------------------------------"
    if True:
        print '\n'
        print "----------------------------------------------------"
        print 'INITIAL CONSTRAINTS RESULTS '
        Constraints=[]
        for i in range(0,best_init.configuration_Manager.get_Number_Subarrays()):
            baselines = ccs.calc_baselines(best_init,i)
            res,mrs,elongation,sidelobe_percentage=ccs.calc_constraints(-1., -50., baselines)
            Constraints.append([])
            Constraints[i].append(res)
            Constraints[i].append(mrs)
            Constraints[i].append(elongation)
            Constraints[i].append(sidelobe_percentage)
            print '------ res, mrs, elongation, sidelobe_percentage for subarray ',i,' ------'
            print Constraints[i]
        print "----------------------------------------------------"

    

#==================================================================================================================================
# Display of final result : 
#==================================================================================================================================
Пример #3
0
elif now in list_constraints_weights_mrs:
    raise Exception('Parameter Maximum_Recoverable_Scale_Sub_' +
                    str(list_constraints_weights_mrs.index(now)) + ' not read')
elif now in list_constraints_weights_e:
    raise Exception('Parameter Elongation_Sub_' +
                    str(list_constraints_weights_e.index(now)) + ' not read')
elif now in list_constraints_weights_s:
    raise Exception('Parameter Percentage_of_Sidelobes_Sub_' +
                    str(list_constraints_weights_s.index(now)) + ' not read')

### To avoid impossible constraints values
p = uf.Init_Pop(Configuration_Input_File, configuration_Manager,
                Source_Declination, Source_Hour_Angle, 1, [num_pads], 1,
                [[1], [1], [1], [1]], [[1], [1], [1], [1]], [1])
arr, b = p.get_Fittest()
basel = ccs.calc_baselines(arr, 0)
res_tot, mrs_tot, el_tot, sid_tot = ccs.calc_constraints(
    Source_Hour_Angle, Source_Declination, basel)
fudge_factor = 0.95
for i in range(0, Number_of_Subarrays):
    if list_objective_constraints_res[i] < (res_tot - fudge_factor):
        raise Exception(
            'Invalid objective constraints value for Spatial Resolution of Subarray '
            + str(i) +
            '. According to the total configuration properties, it should be >'
            + str(res_tot - fudge_factor) + '.')
    elif list_objective_constraints_mrs[i] > (mrs_tot + fudge_factor):
        raise Exception(
            'Invalid objective constraints value for Maximum Recoverable Scale of Subarray '
            + str(i) +
            '. According to the total configuration properties, it should be <'