Java API - Model results uncorrect after first solve of Modelinstance

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
ABMlerGams
User
User
Posts: 5
Joined: 1 year ago

Java API - Model results uncorrect after first solve of Modelinstance

Post by ABMlerGams »

Hi,

I am using the Modelinstance over the Java API with a Modifier. All works fine for the first solve. However, results from many solves after the first one are not what I expect. I do clear the Modifier from previous records before re-solving. Thus, I need to re-intantiate the Instance after every solve from the checkpoint which is extremly slower. Can anybody point me to a similar problem with the API after the first solve?

regards,
Karma
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Java API - Model results uncorrect after first solve of Modelinstance

Post by bussieck »

Hard to say. Can you produce a self-contained example that lets us reproduce your findings. If you are a paying customer, you can also contact support@gams.com.

-Michael
ABMlerGams
User
User
Posts: 5
Joined: 1 year ago

Re: Java API - Model results uncorrect after first solve of Modelinstance

Post by ABMlerGams »

... well this might be a bit difficult but I might do it if desperate enough. Yes, paying customer at University. Could the fact that I use a MIP play into it? The wrong output entails this piece of info:

MIP start 'm1' defined solution with objective 0.0000.
MIP start 'm2' defined no solution.
1 of 2 MIP starts provided solutions.
MIP start 'm1' defined initial solution with objective 0.0000.

This part is definitively different from the first solve statement...
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Java API - Model results uncorrect after first solve of Modelinstance

Post by bussieck »

No, not really. It's just that you get an initial solution. Should not make a difference on the optimal solution. What's your optimality tolerance (optCR). In older versions of GAMS this was at 0.1 by default. Nowadays, it is 1e-6. If you are running an older version perhaps this is the problem.

-Michael
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Java API - Model results uncorrect after first solve of Modelinstance

Post by bussieck »

You can also "export" the model instance by using the Convert solver. This produces a gams.gms file with the model that gets actually solved. Compare the second model instance with the file that is produces when you start the sequence with the second model instance. They should (with the exception of the .l and .m attributes be identical).

-Michael
ABMlerGams
User
User
Posts: 5
Joined: 1 year ago

Re: Java API - Model results uncorrect after first solve of Modelinstance

Post by ABMlerGams »

It was the old GAMS version indeed. Anybody with the same Problem: use the latest GAMS version. Solved for me
Post Reply