I am using PySP (Pyomo) for one stochastic optimization problem. I created a concrete model for my problem and also defined the scenarios based on the farmer's example given in
https://github.com/Pyomo/pysp/blob/main/examples/farmer/concrete/ReferenceModel.py
In the above example a pysp_instance_creation_callback() function is called for each of the scenarios. In the function, an instance of the model is cloned for each scenario so that the scenario variable (Yield in this case) is updated for each of the scenarios using instance.Yield.store_values(Yield[scenario_name]).
I followed a similar approach to my problem. However, in my case, for each scenario the size of the unknown varies unlike the farmer's example, where the scenarios are for just three crops (wheat, sugar, corn). For instance, my scenarios would look like this,
Scenario1 = {123, 124, 118}My code snippet looks something like the one below (I have only mentioned useful constraints and variables for simplicity)
# Variable:However, this method did not work for me. The model.Fault value remains the same for each of the scenarios as it was initialized i.e., {123,124,118}. Although if I check the instance value for each of the scenarios, i.e., instance.Fault.value, then it seems like the values are updating (instance.Fault.value gives different values consistent with different scenarios) but while checking the output lp file for the actual model, the constraints are not updated as desired and the final solution comes the same for each of the scenarios as mentioned before. I am not sure how to tackle this issue and I have been stuck in this problem for days. Can anybody help me here?
Regards,
Abodh