子龙 王

Conversationalist
First Question
  • Total activity 14
  • Last activity
  • Member since
  • Following 0 users
  • Followed by 0 users
  • Votes 1
  • Subscriptions 4

Activity overview

Latest activity by 子龙 王
  • 子龙 王 created a post,

    How to sum variables that are not dimensionally incomplete

    Answered

    x (i,j,k) :{(1, 1, 1) : < gurobi. Var x >,1,1 (1), (1, 1, 2) : < gurobi. Var x (1,1,2) >,(1, 2, 1) : < gurobi. Var x > (1, 2, 1), (1, 2, 2) : < gurobi. Var x >,2,2 (1), (1, 2, 3) : < gurobi. Var (1...

  • 子龙 王 created a post,

    unsupported operand type(s) for >>: 'bool' and 'TempConstr'

    Answered

    model.addConstrs((dx[k+1] == 1) >> (x[i,j,k+1] >= 1) for k in range(4)) dx is defined as: dx = model.addVars(9, vtype = GRB.BINARY, name="dx")X (j, I, k) is defined as: x (j, I, k) = model. AddVar ...

  • 子龙 王 commented,

    I have looked at the relevant website and understood the application of the if constraint in gurobi, but I still don't know how to write my own questions I wonder if it is convenient to provide spe...

  • 子龙 王 created a post,

    Add a new constraint to the model

    Answered

    The complete executable code is as follows: from gurobipy import Model, GRB, quicksumimport sysimport numpy as npimport timeimport os from DataRead import getdata from itertools import chain def MP...

  • 子龙 王 commented,

    The complete executable code is as follows: from gurobipy import Model, GRB, quicksumimport sysimport numpy as npimport timeimport os from DataRead import getdata from itertools import chain def MP...

  • 子龙 王 commented,

    I also tried the following:# constraint(4)# for i in J:#     for j in OJ[i]:#         if j ! = OJ[i][0]: #             p = None#             current_machine = None#             model.update()#     ...

  • 子龙 王 commented,

    I don't know if adding the corresponding code in constraint 4 is the right thing to do, and I appreciate someone giving me some guidance

  • 子龙 王 commented,

    The last line of code is wrong. My new code should read: D[previous_machine][operations_machines],Instead of D(previous_machine,operations_machines),But it also fails in the following parts: for k ...

  • 子龙 王 created a post,

    Add a new constraint to the model

    Open

    from gurobipy import Model, GRB, quicksumimport sysdef MIPModel(Data):    n = Data['n']    m = Data['m']    J = Data['J']    OJ = Data['OJ']    oj=OJ    operations_machines = Data['operations_machi...