in the simple example below, self_defined_function is complicated and can't be expressed with common operator such as +, -.
both arguments, x, y of self_defined_function are float.
my question is how to extract Gurobi variable value of x, y to float so that I can feed both to self_defined_function?
def func(x, y):
r = self_defined_function(x,y)
return r
m = Model("model")
x = m.addVar(vtype=GRB.CONTINUOUS, name="x", lb = 0.1, ub = 1.0)
y = m.addVar(vtype=GRB.CONTINUOUS, name="x", lb = 0.1, ub = 1.0)
r = func(x, y)
m.setObjective(r, GRB.MINIMIZE)
m.optimize()
Thanks.