0

so I ran the example code, and wrote some additional stuff for my problem

   problem = MyProblem(avg_vec,cov_mat,cor_mat,num_vars,num_obj,num_con,lb,ub,func_list,cons_list)
        print(problem)
        algorithm = NSGA2()

        print(algorithm)
        res = minimize(problem,
               algorithm,
               ('n_gen', 20000),
               seed=1)

when I run this, I get the following output

# name: MyProblem
# n_var: 3133
# n_obj: 2
# n_constr: 1


<pymoo.algorithms.nsga2.NSGA2 object at 0x000001B00B384D88>
Traceback (most recent call last):
  File "port_runner.py", line 72, in <module>
    my_port.sharp_moo(func_list,con_list,test_prices, max_port_amount, max_stocks,back_prop_data)
  line 468, in sharp_moo
    seed=1)
TypeError: 'int' object is not callable

I'm a bit confused where the issue is, because none of these functions are integers by some mistake - it isn't even calling my evaluate function for minimize.

Eigenvalue
  • 1,093
  • 1
  • 14
  • 35
  • What happened when you tried reading the documentation, taking note of what types the function expects for its parameters, and comparing it to the types of the arguments provided by your code? – Karl Knechtel Jul 21 '21 at 17:23
  • Have you thoroughly checked [the documentation](https://pymoo.org/interface/minimize.html) to make sure you're meeting all its requirements? – Random Davis Jul 21 '21 at 17:24
  • "it isn't even calling my evaluate function for minimize" In your own words, what is "your evaluate function"? Is it the thing that is named `NSGA2`, or is it a thing that you get as a result of calling `NSGA2`? Or is it something else entirely? – Karl Knechtel Jul 21 '21 at 17:24
  • Thanks RandomDavis and Karl - these suggestions helped me solve the problem - the issue were I had multiple packages imported where "minimize" is implemented. – Eigenvalue Jul 21 '21 at 18:08

1 Answers1

0

I had imported pyomo after importing pymoo. Both libraries have a minimize function, but since I imported pyomo second it used that one which has a different input structure. One can easily solve it by calling the minimize from pymoo explicitly.

Eigenvalue
  • 1,093
  • 1
  • 14
  • 35