I'm working on a Staff Assignment Problem that was initially modeled in PuLP. However, during the development, some constraints as well as the objective became non-linear. After comparing some packages, I chose GEKKO, but somehow can't get my optimization up and running.
I'm facing two issues:
1. Constraint formulation
Let's assume I have simple constraints like these.
In PuLP I have something like:
# Each position p must be assigned to exactly one employee e
for p in position_names:
succession_prob += pulp.lpSum([X[p][e] for e in employee_names]) == 1
# Only employees e that are qualified for position p can be selected
for p in position_names:
for e in employee_names:
succession_prob += X[p][e] <= position_mapping[p][e]
And I tried to do something like this in GEKKO:
# Each position p must be assigned to exactly one employee e
for p in range(len(position_names)):
m.Equation(sum(X[p][e] for e in range(len(employee_names))) == 1)
# Only employees e that are qualified for position p can be selected
for p in range(len(position_names)):
for e in range(len(employee_names)):
m.Equation(X[p][e] <= position_mapping.iloc[e][p])
This doesn't give me an error but I'm not sure whether it is correct. However I get an error when I try to split the (rather complex) objective function:
2. Split objective function
# Dummy functions
numerator = pulp.lpSum(some expression)
denominator = pulp.lpSum(some other expression)
succession_prob += numerator / denominator
Again I tried to do something like this in GEKKO:
numerator = m.Param(some expression)
denominator = m.Param(some other expression)
# Objective function: RCD moves -> max
m.Obj((numerator / denominator)*(-1))
>>> ERROR: unsupported operand type(s) for *: 'float' and 'generator'
I'm wondering whether my code for the constraints correct (choice of variable types etc.), as well as how to fix the split objective. I'm grateful for any help, as I already tried out different variables and just can't it running.