Skip to main content

Min GenExpr and multiplying by -1

Answered

Comments

5 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Hi Phillip,

    Could you please post the (relevant section of) your source code so we can better help you understand the issue?

    Cheers,
    Matthias

    1
  • Phillip Meng
    Gurobi-versary
    Conversationalist
    First Question

    Hi Matthias, we had:

    self.scheme.g_w_relationship = {}
    for b in self.list_of_b:
    self.scheme.g_w_relationship[b] = {}
    for event in self.events:
    self.scheme.g_w_relationship[b][event] = {}
    for season in self.seasons:
    ret_name = 'f_w_rel' + '_' + str(b.id) + '_' + str(event.id) + '_' + str(season.id)
    lhs = self.scheme.g[b][event][season]
    if not season.last:
    rhs = self.model.max_([0, -self.scheme.w[b][event][season.successor]])
    else:
    rhs = 1 - self.scheme.a[b][event][season]
    self.scheme.g_w_relationship[b][event][season] = self.model.add_constraint(full_expression=lhs == rhs, name=ret_name)

    It returns specifically:
    return self._model.addConstr(full_expression, name=name)
    File "model.pxi", line 3218, in gurobipy.Model.addConstr
    File "model.pxi", line 3939, in gurobipy.Model.addGenConstrMax
    gurobipy.GurobiError: Invalid data in vars array

    I hope that is useful.

    Regards, Phillip

    0
  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Hi Phillip,

    I'm sorry but this is still not very helpful. There is no add_constraint method in Gurobi; it appears the model object wraps the Gurobi Model. I also cannot tell what kind of data you are using to construct the max constraint and where the error really comes from.

    Please try to post a minimal reproducible example.

    Cheers,
    Matthias

    0
  • Phillip Meng
    Gurobi-versary
    Conversationalist
    First Question

    Thought I would follow this one up whilst logged in - turns out our modelling was prohibitive for the constraint behaviour we were trying to design. Remodelling seemed to find a way around the issue.

    0

Post is closed for comments.