Time Limit when - Capturing multiple solutions gams 38 cplex c++

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
jabula
User
User
Posts: 3
Joined: 2 years ago

Time Limit when - Capturing multiple solutions gams 38 cplex c++

Post by jabula »

Hello Everyone,

I am new to using GAMS + CPlex + C++. I have however used other modeling platforms like SCIP.

I am using GAMS + Cplex on the C++ API to get multiple near optimal solutions. I have configured this and it runs correctly. The issue is when I try to set a generation time limit, the program runs for the desired time but fails to capture the final solutions generated in the time limit set.

1. This issue is generated with all the MIPs problems I tried. I have attached a sample MIP Problem gotten from https://miplib.zib.de/
2. My cplex.opt options file has the below values set:

- solnpool generatedSoln.gdx
- solnpoolcapacity 5000
- solnpoolgap 0.1
- solnpoolpop 2
- solnpoolintensity 4
- populatelim 100000
- ResLim 5
- *tilim 5


3. I tried both the ResLim and tilim
4. For the particular problem I attached below, I confirmed that at 5 secs, some solutions are generated but not all possible solutions are generated.
5. I also tried setting solnpoolpop to 1 such that it generates all the solutions found as the solving progresses. The problem with this is that it generates way too little number of solutions.
6. When I give a sufficient time limit, I do not encounter the error. Sufficient in this case means enough time for Cplex to end the search for optimal solution by itself without considering my time limit.


Is there a way to tell cplex to save the solutions as they are been generated into the .gdx file such that when my time limit is reached, I have the solutions found so far in my .gdx file?

The error I get is also attached below; The error basically says it doesn't see the .gdx file I am trying to read.

My codes are setup on MAC OS.

set1ch.gms
(4.6 KiB) Downloaded 177 times
set1ch.gdx
(36.77 KiB) Downloaded 172 times
Screen Shot 2022-02-07 at 4.54.45 PM.png
Screen Shot 2022-02-07 at 4.54.45 PM.png
Fred
Posts: 372
Joined: 7 years ago

Re: Time Limit when - Capturing multiple solutions gams 38 cplex c++

Post by Fred »

Hi,

You ran into a known issue that the cplex solution pool is not imported when hitting a time limit. This has been fixed in the meantime and will be contained in the upcoming GAMS 38.2 release (probably later this week or early next week).

Regarding the exception, it may help to set the workingDirectory of your GAMSWorkspace.

I hope this helps!

Fred
jabula
User
User
Posts: 3
Joined: 2 years ago

Re: Time Limit when - Capturing multiple solutions gams 38 cplex c++

Post by jabula »

Hello Fred,

Thanks for the response. Your response did help. Looking. forward to 38.2 to try this out again. I will post back the results.

Thanks again.
jabula
User
User
Posts: 3
Joined: 2 years ago

Re: Time Limit when - Capturing multiple solutions gams 38 cplex c++

Post by jabula »

Hi @Fred,

I also forgot to add that yes: I did set my workingDirectory of GAMSWorkspace using the workspaceinfo :) . I am hoping the 38.2 fix would resolve the issue.

Thanks Again.
Post Reply