Solved

callback procedure that saves new incumbent solution to case file

  • 6 June 2019
  • 4 replies
  • 122 views

Userlevel 1
Hi,

Is it possible for a callback procedure to save the newest incumbent solution to a case file.
Is an example available?

Edit:
I already installed a callback procedure (SetCallbackNewIncumbent).
How can I access the new incumbent solution from that procedure?
And do I need to send the new incumbent solution to the model first, after which I can send it to a case file, or can I send it to a case file directly?

Thanks!

Best, WM
icon

Best answer by deannezhang 7 June 2019, 05:16

View original

This topic has been closed for comments

4 replies

Userlevel 4
Badge +1
In the callback procedure, you can first use function RetrieveCurrentVariableValues to retrieve the variables value from the model;

code:
RetrieveCurrentVariableValues(AllVariables); 


Then use the .Incumbent suffix to retrieve the new incumbent value

code:
MyVariable.Incumbent;


Then use function like CaseFileSave to save those values you need.
Userlevel 1
Hi,

Thanks for your answer, however I get this error...

The function RetrieveCurrentVariableValues cannot be called from a callback issued by GMP::SolverSessionExecute or GMP::SolverSession::AsynchronousExecute.

Any alternatives?

Thanks, W.
Userlevel 4
Badge +1
Hi Wiet, in this case, you may need to use function GMP::Solution::RetrieveFromSolverSession
Userlevel 1
Great, thanks!

Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator