Originally posted by: open_ball
"When you invoke the ArcTime constructor in the last code chunk, you call set.next() three times, which means you are grabbing "from", "to" and "time index" from three consecutive set elements, not from a single element. I suspect that's a bug."
You are right! I made a mistake there and fixed the bug.
"Is there are reason for building a new ArcTime instance rather than just using set.next() as the key for the masterVariable map?"
I create an Arc instance via the ArctTime instance. That is why I do not directly use set.next().
"The other problem, which I think accounts for the error message, is that you do not check in line 4 of the last chunk for masterVariable.get(arcTime) returning a null value. Since you just constructed arcTime, it cannot possibly be a key in masterVariable. If there is an entry in masterVariable whose key matches your arcTime in all fields, there is still the question of whether the ArcTime class overrides the equals() method to treat two instances with identical fields as being equal."
The indices of masterVariable come from indexSet. I do not think that it would return null. Also, I did override hashCode() and equals() methods when I first created the ArcTime class.
Thanks for your answers. I believe that I solved the issue. It looks like it was because of the way I define the masterVariable. Since I did not define it globally and did not pass it into the callback function, I was receiving the error. I defined it as a private final variable and any method within the class can access it.
#CPLEXOptimizers#DecisionOptimization