Skip to main content
Solved

callback procedure that saves new incumbent solution to case file

  • June 6, 2019
  • 4 replies
  • 139 views

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

Best answer by deannezhang

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.
This topic has been closed for replies.

4 replies

deannezhang
AIMMS Champ
Forum|alt.badge.img+3
  • AIMMS Champ
  • 61 replies
  • Answer
  • June 7, 2019
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.

  • Author
  • Ace
  • 8 replies
  • June 11, 2019
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.

deannezhang
AIMMS Champ
Forum|alt.badge.img+3
  • AIMMS Champ
  • 61 replies
  • June 14, 2019
Hi Wiet, in this case, you may need to use function GMP::Solution::RetrieveFromSolverSession

  • Author
  • Ace
  • 8 replies
  • June 17, 2019
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