I am new to GUROBI Optimization and I am trying to code the function which is shown in the picture below:
Unfortunately when I am writing the objective function I get the following error :
'gurobipy.LinExpr' object has no attribute 'exp'
The objective function I have built looks like this:
objective_function = (1/n)*(gp.quicksum(np.log(1+np.exp(-gp.quicksum(score[b_list[j]]*new_df.iloc[i][columns_list[j]] for j in range(j_len))))for i in range(i_len))) + l_param*gp.quicksum(1 for j in range(j_len))
where " new_df.iloc[i][columns_list[j]] "is the Xi,j of the function and " score[b_list[j]] " are the bj covariates.
Furthermore the score variable is set as:
score = m.addVars(b_list, name="b_covariates")
I sense that i should use a piecewise-linear approximation of the function but due to the nested sums, logarithm and exponential I am a little confused.
I would appreciate it if someone could shed me some light in order to continue.
Please sign in to leave a comment.