From e1510da294b618be4c45cd438998ca5ccceeec6d Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Wed, 16 Jul 2025 18:41:38 +0200 Subject: [PATCH 1/3] adjust to changed meaning of threads=0 --- src/ModelingSystem/ModelingSystemGAMS.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ModelingSystem/ModelingSystemGAMS.cpp b/src/ModelingSystem/ModelingSystemGAMS.cpp index aab1f401..fa7445de 100644 --- a/src/ModelingSystem/ModelingSystemGAMS.cpp +++ b/src/ModelingSystem/ModelingSystemGAMS.cpp @@ -175,7 +175,12 @@ void ModelingSystemGAMS::updateSettings(SettingsPtr settings) } // Sets the number of threads - env->settings->updateSetting("MIP.NumberOfThreads", "Dual", gevThreads(modelingEnvironment)); + // gevThreadsRaw >= 0 from GAMS have the same meaning in SHOT + // for gevThreadsRaw < 0, use gevThreads() to translate to number of processors to use + int nthreads = gevGetIntOpt(modelingEnvironment, gevThreadsRaw); + if( nthreads < 0 ) + nthreads = gevThreads(modelingEnvironment); + env->settings->updateSetting("MIP.NumberOfThreads", "Dual", nthreads); env->output->outputDebug(fmt::format( " MIP number of threads set to {} by GAMS", env->settings->getSetting("MIP.NumberOfThreads", "Dual"))); From 1afd6f369465fc0b411c0a8fcb45a9061388f8a2 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Wed, 16 Jul 2025 18:42:24 +0200 Subject: [PATCH 2/3] additional QExtract options --- src/ModelingSystem/ModelingSystemGAMS.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ModelingSystem/ModelingSystemGAMS.cpp b/src/ModelingSystem/ModelingSystemGAMS.cpp index fa7445de..fabac9db 100644 --- a/src/ModelingSystem/ModelingSystemGAMS.cpp +++ b/src/ModelingSystem/ModelingSystemGAMS.cpp @@ -104,6 +104,13 @@ void ModelingSystemGAMS::augmentSettings([[maybe_unused]] SettingsPtr settings) #endif settings->createSetting("GAMS.QExtractAlg", "ModelingSystem", 0, "Extraction algorithm for quadratic equations in GAMS interface", enumQExtractAlg); + +#if GMOAPIVERSION >= 28 + settings->createSetting("GAMS.QExtractDenseSwitchFactor", "ModelingSystem", 0.008, + "Sparse/dense factor for quadratic extraction algorithm in GAMS interface.", 0.0); + settings->createSetting("GAMS.QExtractDenseSwitchLog", "ModelingSystem", false, + "Whether to print additional information about sparse/dense factor choice in quadratic extraction algorithm in GAMS interface."); +#endif #endif } @@ -288,6 +295,10 @@ E_ProblemCreationStatus ModelingSystemGAMS::createProblem(ProblemPtr& problem) #if GMOAPIVERSION >= 21 int qextractalg = env->settings->getSetting("GAMS.QExtractAlg", "ModelingSystem"); gmoQExtractAlgSet(modelingObject, qextractalg); +#endif +#if GMOAPIVERSION >= 28 + gmoQExtractDenseSwitchFactorSet(modelingObject, env->settings->getSetting("GAMS.QExtractDenseSwitchFactor", "ModelingSystem")); + gmoQExtractDenseSwitchLogSet(modelingObject, (int)env->settings->getSetting("GAMS.QExtractDenseSwitchLog", "ModelingSystem")); #endif gmoUseQSet(modelingObject, 1); #if GMOAPIVERSION >= 25 From 5a41678a05cabf29b5cb470164dd0e9ee4d12de1 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Wed, 16 Jul 2025 18:42:43 +0200 Subject: [PATCH 3/3] handle GAMS license files with 7 or 8 lines --- src/ModelingSystem/ModelingSystemGAMS.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ModelingSystem/ModelingSystemGAMS.cpp b/src/ModelingSystem/ModelingSystemGAMS.cpp index fabac9db..d8c2aab9 100644 --- a/src/ModelingSystem/ModelingSystemGAMS.cpp +++ b/src/ModelingSystem/ModelingSystemGAMS.cpp @@ -618,6 +618,8 @@ void ModelingSystemGAMS::createAuditLicensing() palLicenseRegisterGAMS(auditLicensing, 4, gevGetStrOpt(modelingEnvironment, "License4", buf)); palLicenseRegisterGAMS(auditLicensing, 5, gevGetStrOpt(modelingEnvironment, "License5", buf)); palLicenseRegisterGAMS(auditLicensing, 6, gevGetStrOpt(modelingEnvironment, "License6", buf)); + palLicenseRegisterGAMS(auditLicensing, 7, gevGetStrOpt(modelingEnvironment, "License7", buf)); + palLicenseRegisterGAMS(auditLicensing, 8, gevGetStrOpt(modelingEnvironment, "License8", buf)); palLicenseRegisterGAMSDone(auditLicensing); palLicenseCheck(auditLicensing, gmoM(modelingObject), gmoN(modelingObject), gmoNZ(modelingObject),