Exemplo n.º 1
0
int GamsScip::readyAPI(
   struct gmoRec*     gmo_,               /**< GAMS modeling object */
   struct optRec*     opt_                /**< GAMS options object */
)
{
   char buffer[512];

   gmo = gmo_;
   assert(gmo != NULL);

   if( getGmoReady() || getGevReady() )
      return 1;

   gev = (gevRec*)gmoEnvironment(gmo);
   assert(gev != NULL);

   ipoptlicensed = false;
#ifdef GAMS_BUILD
   if( pal == NULL && !palCreate(&pal, buffer, sizeof(buffer)) )
      return 1;

#define PALPTR pal
#include "coinlibdCL5svn.h" 
   palGetAuditLine(pal, buffer);
   gevLogStat(gev, "");
   gevLogStat(gev, buffer);
   gevStatAudit(gev, buffer);

   initLicensing(gmo, pal);

#ifdef COIN_HAS_OSIXPR
   /* Xpress license setup - don't say anything if failing, since Xpress is not used by default */
   XPlicenseInit_t initType;
   gevxpresslice(gev, pal, gmoM(gmo), gmoN(gmo), gmoNZ(gmo), gmoNLNZ(gmo), gmoNDisc(gmo), 0, &initType, buffer, sizeof(buffer));
#endif
#endif

   // check for academic license, or if we run in demo mode
   if( !checkScipLicense(gmo, pal) )
   {
      gevLogStat(gev, "*** Use of SCIP is limited to academic users.");
      gevLogStat(gev, "*** Please contact [email protected] to arrange for a license.");
      gmoSolveStatSet(gmo, gmoSolveStat_License);
      gmoModelStatSet(gmo, gmoModelStat_LicenseError);
      return 1;
   }

   ipoptlicensed = HSLInit(gmo, pal);

   // print version info and copyright
   if( SCIPsubversion() > 0 )
      sprintf(buffer, "SCIP version %d.%d.%d.%d (" SCIP_GITHASH ")\n", SCIPmajorVersion(), SCIPminorVersion(), SCIPtechVersion(), SCIPsubversion());
   else
      sprintf(buffer, "SCIP version %d.%d.%d (" SCIP_GITHASH ")\n", SCIPmajorVersion(), SCIPminorVersion(), SCIPtechVersion());
   gevLogStatPChar(gev, buffer);
   gevLogStatPChar(gev, SCIP_COPYRIGHT"\n\n");

   // install or update error printing callback in SCIP to use current gev
   SCIPmessageSetErrorPrinting(printErrorGev, (void*)gev);

   // setup (or reset) SCIP instance
   SCIP_RETCODE scipret;
   scipret = setupSCIP();

   if( scipret != SCIP_OKAY )
   {
      snprintf(buffer, sizeof(buffer), "Error %d in call of SCIP function\n", scipret);
      gevLogStatPChar(gev, buffer);
      gmoSolveStatSet(gmo, gmoSolveStat_SystemErr);
      gmoModelStatSet(gmo, gmoModelStat_ErrorNoSolution);
      return 1;
   }

   assert(scip != NULL);

   // print info on used external codes
   SCIPprintExternalCodes(scip, NULL);

   return 0;
}
Exemplo n.º 2
0
int _tmain (int argc, _TCHAR **argv)
{

  for (int i = 0; i < argc; ++i)
  {
      out << argv[i] << std::endl;
  }

  if (argc < 2)
  {
    showHelp ();
    return (0);
  }

  params_t params;

  if (!parseCmdLine (argc - 1, argv + 1, &params))
  {
    if (otUnknown == params.opType) 
    {
      out << _T (" : unknown operation") << std::endl;
    }
    else
    {
      out << _T ("bad command line") << std::endl;
    }
    return (-1);
  }

  if (FAILED (initLicensing (AppInfo, params.basesPaths, CLicensingPolicy::cmKeyOnly))) 
  {
    return (-1);
  }

//  synchronizeKeys (AppInfo, KeyFile1, 0);

#if defined (_WIN32)
  SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_NEUTRAL), SORT_DEFAULT));
  CComLib comLib;
#endif

  switch(params.opType) 
  {
    case otKeyReg             : 
    case otKeyRegAdd          : regKey (params.keyFileName, params.keyAddMode); break;
    case otKeyRevoke          : revokeKey (params.serialNumber); break;
    case otCheckActiveKey     :	checkActiveKey (); break;
    case otKeyFileInfo        : keyFileInfo (params.keyFileName); break;
    case otViewInstalledKeys  : viewInstalledKeys (); break;
    case otViewBlacklist      : viewBlacklist (params.blacklistName); break;
    case otCheckAgainstBlacklist: checkAgainstBlackList (params.blacklistName.c_str ()); break;
    case otCheckKeyBlacklist  : checKeyBlacklist (params.keyFileName, params.blacklistName); break;
    case otCheckKeyFile       : 
    case otCheckKeyFileAdd    : 
        checkKeyFile (params.keyFileName, params.keyAddMode); break;
    default                   : break;
  }

//  recreateTest (AppInfo, params.basesPaths, CLicensingPolicy::cmFullCheck);

  return (0);

}