Delete files during execution not in compile phase
Posted: Fri Apr 17, 2020 9:22 pm
Hi all,
I am using the usercutcall und userIncbCall functionality by the BCH facility.
The logic is as follows:
- userincbcall is called once incumbent solution has been determined during branch and bound (/cut) process. This might happen several times in a sequence (i.e. several incumbents are found in a series, each time the program is executed). The called program is identifying some relevant cuts and rejects the current incumbent solution if it is infeasible. Delta logic for cuts is working fine, means all identified cuts by several execution of the program incbcall.inc are kept in a file called 'nextcuts.gdx'.
- usercutcall is used to determine cuts as well and to (finally) add all cuts which have been identified since the last execution. This also works fine as the bchin.gdx file is automatically created by GAMS once execution of the program for usercutcall has finished.
Currently, I am struggling with two things:
- after completion of the usercutcall program cutcall.inc I would like to delete the file 'nextcuts.gdx' as it is not needed anymore and the file is getting bigger and bigger as new userincbcalls are following which are reading the already given cuts and adding them again to the cut pool. The command $call rm -f 'nextcuts.gdx' in the program cutcall.inc is (in my understanding) not working as it is executed during compile (not execution) phase and will drop the file before the cuts are added to the cut pool.
- the bchin.gdx file is getting quite big as the usercutcall is doing some quite intense logic and all parameters, sets and scalars are exported automatically. Is there a way to export manually? I have tried to create bchin.gdx file on my own but the file has been overwritten.
Kind regards,
Jonathan
I am using the usercutcall und userIncbCall functionality by the BCH facility.
The logic is as follows:
- userincbcall is called once incumbent solution has been determined during branch and bound (/cut) process. This might happen several times in a sequence (i.e. several incumbents are found in a series, each time the program is executed). The called program is identifying some relevant cuts and rejects the current incumbent solution if it is infeasible. Delta logic for cuts is working fine, means all identified cuts by several execution of the program incbcall.inc are kept in a file called 'nextcuts.gdx'.
- usercutcall is used to determine cuts as well and to (finally) add all cuts which have been identified since the last execution. This also works fine as the bchin.gdx file is automatically created by GAMS once execution of the program for usercutcall has finished.
Currently, I am struggling with two things:
- after completion of the usercutcall program cutcall.inc I would like to delete the file 'nextcuts.gdx' as it is not needed anymore and the file is getting bigger and bigger as new userincbcalls are following which are reading the already given cuts and adding them again to the cut pool. The command $call rm -f 'nextcuts.gdx' in the program cutcall.inc is (in my understanding) not working as it is executed during compile (not execution) phase and will drop the file before the cuts are added to the cut pool.
- the bchin.gdx file is getting quite big as the usercutcall is doing some quite intense logic and all parameters, sets and scalars are exported automatically. Is there a way to export manually? I have tried to create bchin.gdx file on my own but the file has been overwritten.
Kind regards,
Jonathan