• Gurobi Staff

Have you tried running the computeIIS or the feasRelax method on the infeasible model? Please see the following articles:

Best regards,
Simran

Hi Simranjit,
I modified my code but now i am getting a key error:0 in objective function. Could you please help me ?

import gurobipy as gpfrom gurobipy import GRB# Create a new Gurobi modelmodel = gp.Model("production_planning")
# Define the sizes of the setsi = 6j = 4m = 2# Create sets I, J, and MI = range(i)  # Parts set from 1 to i_nJ = range(j)  # Jobs set from 1 to j_nM = range(m)  # Machines set from 1 to m_n
# Define the parameters for each parth = {1: 25.10, 2: 37.25, 3: 39.24, 4: 4.27, 5: 13.56, 6: 2.18}  # Height of each parta = {1: 569.53, 2: 464.89, 3: 779.96, 4: 122.62, 5: 390.39, 6: 178.34}  # Production area of each partV = {1: 2867.59, 2: 2378.05, 3: 16420.91, 4: 102.83, 5: 3640.48, 6: 214.79}  # Material volume of each part# Define the parameters for each machineMC = 2  # Cost per unit volume of materialTC = {1: 60, 2: 80}  # Operation cost per unit time for each machineVT = {1:0.030864, 2:0.030864} # Time for forming per unit volume of material for each machineHT = {1: 1.4, 2: 0.7}  # Accumulated interval time per unit height for each machineHC = 20  # Cost of human work per unit timeST = {1: 2, 2: 1}  # Setup time needed for each machineH = {1: 32.5, '2': 40}  # Maximum height of part that each machine can processA = {1: 625, 2: 1600} # Maximum production area of part that each machine can process
#Decision variablesX = model.addVars(j, i, vtype=GRB.BINARY, name="X")Y = model.addVars(m, j, vtype=GRB.BINARY, name="Y")Z = model.addVars(j, vtype=GRB.BINARY, name="Z")      #indicator variableJPC = model.addVars(m, j, lb=0.0, ub=1.0, vtype=GRB.CONTINUOUS, name="JPC")
model.update()
#Objective functionmodel.setObjective((sum(JPC[m,j] for m in M for j in J) / sum(V[i] for i in I)), GRB.MINIMIZE

Here in the objective function i have key error 0.