HxVersion Class

class Hexaly.Optimizer.HxVersion

Version, license and copyright info.

In addition to library version information, this class lets you control which licenses are used when any new HexalyOptimizer object is created. With the right methods, you can dynamically load licenses that are not in the default locations, or easily switch from local to cloud execution in a single line. These license changes will only be taken into account for new HexalyOptimizer objects, and has no impact on existing ones.

There are two ways to change the license used:

  1. Directly specify the contents of the license file. This is done via the GetLicenseContent() and SetLicenseContent(string) methods.

  2. Or by changing the license path using the GetLicensePath() and SetLicensePath(string) methods.

When both methods are used, the content always takes precedence over the path. In other words, if the GetLicenseContent() method returns a string that is neither null nor empty, this content will be used instead of the path returned by GetLicensePath().

When the HexalyOptimizer library is loaded, the LicenseContent and LicensePath fields are automatically populated with default values.

The LicenseContent field is automatically populated based on the following information (in order of priority):

  1. The contents of the HX_LICENSE_CONTENT environment variable, if defined.

  2. The contents of the LS_LICENSE_CONTENT environment variable, if defined. Its use has been deprecated since Hexaly 13.0.

  3. An empty string.

The LicensePath field is populated using the following information (in order of priority):

  1. The contents of the HX_LICENSE_PATH environment variable, if defined.

  2. The contents of the LS_LICENSE_PATH environment variable, if defined. Its use has been deprecated since Hexaly 13.0.

  3. If a file named license.dat exists in the current execution folder, the absolute path to this file.

  4. The path to c:\hexaly_14_0\license.dat on Windows, or /opt/hexaly_14_0/license.dat on Linux and macOS if such a file exists.

  5. The path to the file c:\hexaly\license.dat on Windows or /opt/hexaly/license.dat on Linux and macOS if such a file exists.

  6. The path to the file c:\\localsolver\\license.dat on Windows or /opt/localsolver/license.dat on Linux and macOS if such a file exists. Note that the use of this file has been deprecated since Hexaly 13.0.

  7. If none of these files exist, LicensePath is populated with the default path c:\hexaly_14_0\license.dat on Windows, or /opt/hexaly_14_0/license.dat on Linux and macOS.

For windows users: If you used the installer to setup Hexaly, the HX_LICENSE_PATH environment variable is already defined and points to the license file present in the installation folder.

Summary

Methods

GetMajorVersionNumber

Returns Hexaly Optimizer major version number.

GetMinorVersionNumber

Returns Hexaly Optimizer minor version number.

GetBuildDate

Returns Hexaly Optimizer build date.

GetPlatform

Returns the platform of the Hexaly Optimizer binary as a string.

GetVersion

Returns Hexaly Optimizer version as a string.

GetVersionCode

Returns Hexaly Optimizer version code as an integer in the range [0, 29999].

GetCopyright

Returns Hexaly Optimizer copyright as a string.

GetInfo

Returns version and copyright info as a string.

GetLicensePath

Returns the license path of Hexaly Optimizer.

SetLicensePath

Change the license path used by Hexaly Optimizer.

GetLicenseContent

Returns the license content previously set with SetLicenseContent() or the HX_LICENSE_CONTENT environment variable.

SetLicenseContent

Change the license content that will be used for all new HexalyOptimizer objects.

GetLicenseMaxVersionCode

Returns the code of the maximum version supported by the current license.

GetLicenseExpirationDate

Returns the expiration date of the current license.

Static methods

static int GetMajorVersionNumber()

Returns Hexaly Optimizer major version number. This number is an integer in the range [0, 2999].

Returns:

Major version number.

Return type:

int

static int GetMinorVersionNumber()

Returns Hexaly Optimizer minor version number. This number is an integer in the range [0, 9].

Returns:

Minor version number.

Return type:

int

static int GetBuildDate()

Returns Hexaly Optimizer build date. This number is an integer YYYYMMDD with YYYY the year, MM the month, DD the day.

Returns:

Build date.

Return type:

int

static int GetPlatform()

Returns the platform of the Hexaly Optimizer binary as a string. The format of the string is PPPPXX where PPPP is the platform (Win, Linux or MacOS) and XX is the architecture (32 or 64 bits).

Since:

3.0

Returns:

Platform as string.

Return type:

string

static string GetVersion()

Returns Hexaly Optimizer version as a string. The format of the string is: MA.MI.YYYYMMDD-PPPPXX with MA the major number version, MI the minor number version, YYYY the year, MM the month, DD the day, PPPP the platform (Win, Linux or MacOS) and XX the architecture (32 or 64 bits)

Returns:

Version as string MA.MI.YYYYMMDD-PPPPXX

Return type:

string

static int GetVersionCode()

Returns Hexaly Optimizer version code as an integer in the range [0, 29999]. The version code is computed as follows: MA * 10 + MI with MA the major number version, MI the minor number version.

Returns:

Version code

Return type:

int

static string GetCopyright()

Returns Hexaly Optimizer copyright as a string.

Returns:

Copyright notice.

Return type:

string

static string GetInfo()

Returns version and copyright info as a string.

Returns:

Version and copyright info.

Return type:

string

static string GetLicensePath()

Returns the license path of Hexaly Optimizer. This path will be used for any new HexalyOptimizer object. Existing objects will not be affected the path change.

This method returns the value specified by the user if SetLicensePath(string) was called. Otherwise, a default value is returned. This default value is described at the top of this document.

Since:

3.0

Returns:

Path to the license

Return type:

string

See:

HxVersion.SetLicensePath(string)

See:

HxVersion.GetLicenseContent()

See:

HxVersion.SetLicenseContent(string)

static void SetLicensePath(string path)

Change the license path used by Hexaly Optimizer. This path will be used for any new HexalyOptimizer object. Existing objects will not be affected by the path change.

Since:

3.0

Arguments:

path (string) – New path for the license

See:

HxVersion.GetLicensePath()

See:

HxVersion.GetLicenseContent()

See:

HxVersion.SetLicenseContent(string)

static string GetLicenseContent()

Returns the license content previously set with SetLicenseContent() or the HX_LICENSE_CONTENT environment variable. The license content will be used for all new HexalyOptimizer object. Existing objects will not be affected by the change.

Since:

5.0

Returns:

The content of the license or an empty string if the content was not set.

Return type:

string

See:

HxVersion.SetLicenseContent(string)

See:

HxVersion.GetLicensePath()

See:

HxVersion.SetLicensePath(string)

static void SetLicenseContent(string licenseContent)

Change the license content that will be used for all new HexalyOptimizer objects. Existing objects will not be affected by the change.

The content passed as a parameter must be the complete license content as it appears in your file, e.g. LICENSE_KEY = XXXX where XXXX is your license number. The content may include several lines.

Since:

5.0

Arguments:

licenseContent (string) – content of the license to use.

See:

HxVersion.GetLicenseContent()

See:

HxVersion.GetLicensePath()

See:

HxVersion.SetLicensePath(string)

static int GetLicenseMaxVersionCode()

Returns the code of the maximum version supported by the current license. The current license is the one that will be used for any new HexalyOptimizer object. It is determined according to the priority order defined at the top of this document.

The version code is computed as follows: MA * 10 + MI with MA the major number version, MI the minor number version.

This method does not work for cloud licenses. In that case, an exception will be thrown. An exception will also be thrown if the current license does not exist, or if it is not well-formed or cannot be found.

Since:

14.0

static DateTime GetLicenseExpirationDate()

Returns the expiration date of the current license. The current license is the one that will be used for any new HexalyOptimizer object. It is determined according to the priority order defined at the top of this document. The expiration date is always expressed in local time (i.e. without time zone information).

This method does not work for cloud licenses. In that case, an exception will be thrown. An exception will also be thrown if the current license does not exist, or if it is not well-formed or cannot be found.

Since:

14.0