I have a problem that takes place over a finite time horizon.
I solve and get a satisfactory solution.
Then, I want to analyze the impact of an event not previously contemplated, of which I know its “form” and its (discrete) instant t of occurrence.

I keep (using the fix command) all variables at their obtained values up to t;
I insert the event;
and resolve as at the beginning (but with the difference of the fixed values).

It does not work.

Conceptually, am I doing something wrong?

I would appreciate any guide with similar situations.

Unfortunately the problem is very complex and uses a lot of external data so I couldn’t upload it.

Can you provide more explanation of what is happening, when “It does not work”? In particular, it will be helpful if you can answer the following questions:

After you fix variables and change the model to reflect the new event, what messages do you get from AMPL and the solver when you attempt to re-solve? (You can copy them and paste them into your reply.)

When you re-solve, if the solver reports “optimal solution”, then what is wrong with that solution?

Thank you very much Mr. Fourer for your attention.

I apologize for the little information given about the problem. I just didn’t want to be too pushy.

Since I uploaded the message until now I have made some changes that seem to have solved the problem.

The problem scenario was in generic terms…

The optimally solved problem gives a maintenance schedule, from a time lapsus from t to T (t = 1,2,…T) under a series of current conditions.

In this situation, with the planning done, I want to observe the impact of a disruptive event that alters the previous planning.

If I assume that the event occurs at a time (tc+1), in which the system would have followed the planned schedule until time tc, the logical path is:

Fix all variables to their values until time tc,

Insert the event,

Resolve (with values fixed up to tc)

Compare the disruption caused by the event.

This didn’t work, because Gurobi gave an error message.

What have I changed so that it works now?

Nothing in the concept, however there were two calculated variables that were not capable of being recalculated appropriately.

I have simply transformed the calculated variables into equality restrictions.

Since one of the variables was binary in nature (which cannot be declared as such if the variable is calculated) the solution is of better quality, and equally fast. And of course it does what is expected.

I hope I have clarified the doubt.
Thank you again very much for your support.

I am glad to hear that you have the model working now.

As I understand it, you have variables that are defined (calculated) by a statement of the form

var X = <expression>;

If you fix all of the variables in the <expression>, then AMPL will fix X, too. But if you fix only some of the variables in the <expression>, and you also want to fix X, then you have to transform this definition into an equality constraint (as you have done).