0

I want to be able to use a text file of requirements to be prioritized.

I want to male swarm_size,min_values and maximum_values inputs from text file.

SSA Function

def salp_swarm_algorithm(swarm_size = 5, min_values = [-5,-5], max_values = [5,5], iterations = 50):    
    count = 0
    position = initial_position(swarm_size = swarm_size, min_values = min_values, max_values = max_values)
    food = food_position(dimension = len(min_values))

    while (count <= iterations):

        print("Iteration = ", count, " Requirement = ", food.iloc[food['Fitness'].idxmin(),-1])

        c1 = 2*math.exp(-(4*(count/iterations))**2)

        food = update_food(position, food)        
        position = update_position(position, food, c1 = c1, min_values = min_values, max_values = max_values)

        count = count + 1 

    print(food.iloc[food['Fitness'].idxmin(),:].copy(deep = True))    
    return food.iloc[food['Fitness'].idxmin(),:].copy(deep = True)
Toby
  • 12,743
  • 8
  • 43
  • 75
  • Okay, so what's the issue? Have you searched for Pythons file module documentation? – OneCricketeer Dec 05 '18 at 03:32
  • Is the function adequate to be applied to requirement prioritization – Engr Arome Dec 05 '18 at 04:09
  • I don't know what that means :\ Especially not considering we cannot see your input data, and these functions `initial_position` and `food_position` – OneCricketeer Dec 05 '18 at 05:03
  • You see what I really want to do is create a program that will optimize a set of requirements by prioritizing them, and I want to use a salp swarm algorithm, but I also want to upload the requirements to the algorithm via a text file. Please I need help. – Engr Arome Dec 05 '18 at 09:42

0 Answers0