static void ReportGDXError() { string S = string.Empty; Console.WriteLine("**** Fatal GDX Error"); gdx.gdxErrorStr(gdx.gdxGetLastError(), ref S); Console.WriteLine("**** " + S); Environment.Exit(1); }
static bool WriteModelData(string fnGDXFile) { int status = 0; string msg = string.Empty; string[] Indx = new string[gamsglobals.maxdim]; double[] Values = new double[gamsglobals.val_max]; gdx.gdxOpenWrite(fnGDXFile, "XP_Example2", ref status); if (status != 0) { return(GDXError(status, "gdxOpenWrite")); } if (0 == gdx.gdxDataWriteStrStart("Demand", "Demand Data", 1, gamsglobals.dt_par, 0)) { return(GDXError(gdx.gdxGetLastError(), "gdxDataWriteStrStart")); } Indx[0] = "New-York"; Values[gamsglobals.val_level] = 324.0; gdx.gdxDataWriteStr(Indx, Values); Indx[0] = "Chicago"; Values[gamsglobals.val_level] = 299.0; gdx.gdxDataWriteStr(Indx, Values); Indx[0] = "Topeka"; Values[gamsglobals.val_level] = 274.0; gdx.gdxDataWriteStr(Indx, Values); if (0 == gdx.gdxDataWriteDone()) { return(GDXError(gdx.gdxGetLastError(), "gdxDataWriteDone")); } if (gdx.gdxClose() != 0) { return(GDXError(gdx.gdxGetLastError(), "gdxClose")); } return(true); }