Skip to main content
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
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.
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.
Hi Wiet, in this case, you may need to use function GMP::Solution::RetrieveFromSolverSession
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