I am solving a CP model iteratively with same variables and constraints but different objective functions. The structure of the objective function does not change. The only things that change, from an iteration to the next, are the data arrays based on which the objective function is created in each iteration.
In my current implementation, in each iteration I delete the previous objective function and add a new objective function with new data arrays which is very time consuming. Actually the objective is very huge and its deletion is the source of long run time.
Is it possible just to change the data arrays in each iteration inside of the objective expression to correct the objective function rather than deleting the previous objective function and adding the new objective function?
An example of such objective function is as follows:
Thanks in advance for your comments.