something wrong with my MILP model
回答済みI just want to reproduce the math model in conference"Optimal Production Scheduling for Smart Manufacturers"and I thought I had almost finished this simulation before i add the last constraints.without the lase constraints,my model can run smoothly and get a right result.But I add the last constraints, here comes error.
here is the last constraints:
alpha and belta are 1\0 variables.alpha means the on/off status of manufacturing line l at time t,and belta means the manufacturing status of product type q, which is equal to 1 if it is manufactured in line l at time t .T means time the line must stop when it changes the kinds of products it produces.
here is my code :
I really don't know how could this be?
-
正式なコメント
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?. -
The error message says that you are accessing the key ('Delta', 25) which does not exist. How did you define a?
0 -
I define the model like
Line means the name of line,Type represents 6 kinds of product.
and these are my variables alpha and belta.range(1,25)means 24 hours.
is there something wrong?
0 -
You create a (and b) variables with indices from 1 to 24. In the problematic constraint, however, you are trying to access a['Delta', 25] (which does not exist).
Where you create the problematic constraint, your t ranges from 2 to 24 and then your t1 from t to t+5 (in the 'Delta' case).
I don't know your model or the problem you are modeling, but you need to make sure that you do not access non-existing keys. So you may want e.g. a larger range for a, a smaller range for t and/or t1 or (if your schedule is supposed to be periodic) you could have your t1 roll over after 24 hours (and use something like t1 modulo 24).
1 -
oh,thank you very much.I never thought about this before.Yes,my t1 must stay in24 hours. I try it like this.
then it can't stop,it works all the time and can't give me the result.like this.
I can't write the code like that?
0 -
I am glad you could figure it out. From what I have seen, your code looks all right now.
The last screenshot shows a Gurobi log, which means that the solver is running and optimizing your model. Depending on the size and complexity of the model, this may, however, take a while. I can also see that at the time of the screenshot, the solver is close to an optimal solution since the MIP gap is already quite small (0.04%).
If this takes too long, you could try setting a termination criterion such as a TimeLimit or MIPGap and then see if the solution is good enough for your application.
1 -
I already find the way out.Thanks,dear Silke.
0
投稿コメントは受け付けていません。
コメント
7件のコメント