Is there a GAMSCallback - like GRBCallback

Hi guys,

a few days ago i discovered that GAMS is providing a new C++ API. I have read the whole documentation and watched all examples (examples do no compile without modification of project properties by hand) but there are many questions left. There is no callback, isnt it? I am not quit sure, because i dont understand the abstraction of a GAMSCheckpoint - mabye it is a callback, but i dont think so. It looks like a specific state of the model. So you wont get any output during the GAMS procedure? I just need a kind of callback functionality to display the progress of the optimization in my own application which is easy to realize with OPL and Gurobi. Why does the API ignore display commands within the modelStr?

There is no way to create equations on the fly, isnt it? I can not add a GAMSEquation to the model. I am looking for something simulary to GRBLinExpr or ILOLinExpr, respectively.

Hi Stephocke,

you can get the gams process ouput by using the GAMSJob::run(GAMSOptions& gamsOptions, std::ostream& outstream) method, which is used in the example below.

#include "gams.h"
#include <iostream>

using namespace gams;
using namespace std;

int main(int argc, char* argv[])
{
    GAMSWorkspaceInfo wsInfo;
    if (argc > 1)
        wsInfo.setSystemDirectory(argv[1]);
    GAMSWorkspace ws(wsInfo);
    ws.gamsLib("circpack");

    // GAMSJob options
    GAMSOptions options = ws.addOptions();
    options.setNLP("scip");

    // create a GAMSJob from file
    GAMSJob t1 = ws.addJobFromFile("circpack.gms");

    // run GAMSJob and write the process output to std::cout
    std::ostream os(std::cout.rdbuf());
    t1.run(options, os);

    return 0;
}



You can use equations via gams code and call GAMSWorkspace::addJobFromFile(“my.gms”), but the API does not support adding them on the fly.