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
HexalyOptimizerobject 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 newHexalyOptimizerobjects, and has no impact on existing ones.There are two ways to change the license used:
Directly specify the contents of the license file. This is done via the
get_license_content()andset_license_content()methods or with the corresponding shortcutlicense_content.Or by changing the license path using the
get_license_path()andset_license_path()methods or with the corresponding shortcutlicense_path.
When both methods are used, the content always takes precedence over the path. In other words, if the
license_contentattribute returns a string that is neither null nor empty, this content will be used instead of the path returned bylicense_path.When the HexalyOptimizer library is loaded, the
license_contentandlicense_pathattributes are automatically populated with default values.The
license_contentattribute is automatically populated based on the following information (in order of priority):The contents of the
HX_LICENSE_CONTENTenvironment variable, if defined.The contents of the
LS_LICENSE_CONTENTenvironment variable, if defined. Its use has been deprecated since Hexaly 13.0.An empty string.
The
license_pathattribute is populated using the following information (in order of priority):The contents of the
HX_LICENSE_PATHenvironment variable, if defined.The contents of the
LS_LICENSE_PATHenvironment variable, if defined. Its use has been deprecated since Hexaly 13.0.If a file named
license.datexists in the current execution folder, the absolute path to this file.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.
The path to the file
c:\hexaly\license.daton Windows or/opt/hexaly/license.daton Linux and macOS if such a file exists.The path to the file
c:\\localsolver\\license.daton Windows or/opt/localsolver/license.daton Linux and macOS if such a file exists. Note that the use of this file has been deprecated since Hexaly 13.0.If none of these files exist,
license_pathis 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_PATHenvironment variable is already defined and points to the license file present in the installation folder.
Summary¶
Major version number. |
|
Minor version number. |
|
Build date. |
|
Platform of the Hexaly Optimizer binary. |
|
Version as string. |
|
Version code. |
|
Hexaly Optimizer copyright. |
|
Version and copyright info. |
|
License path. |
|
License content. |
|
Code of the maximum version supported by the current license. |
|
Expiration date of the current license. |
Returns Hexaly Optimizer major version number. |
|
Returns Hexaly Optimizer minor version number. |
|
Returns Hexaly Optimizer build date. |
|
Returns the platform of the Hexaly Optimizer binary as a string. |
|
Returns Hexaly Optimizer version as a string. |
|
Returns Hexaly Optimizer version code as an integer in the range [0, 29999]. |
|
Returns Hexaly Optimizer copyright as a string. |
|
Returns version and copyright info as a string. |
|
Returns the license path of Hexaly Optimizer. |
|
Change the license path used by Hexaly Optimizer. |
|
Returns the license content previously set with set_license_content() or the HX_LICENSE_CONTENT environment variable. |
|
Change the license content that will be used for all new HexalyOptimizer objects. |
|
Returns the code of the maximum version supported by the current license. |
|
Returns the expiration date of the current license. |
Instance methods¶
- HxVersion.get_major_version_number()¶
Returns Hexaly Optimizer major version number. This number is an integer in the range
[0, 2999].You can also use the shortcut member
major_version_number- Returns:
Major version number.
- Return type:
int
- HxVersion.get_minor_version_number()¶
Returns Hexaly Optimizer minor version number. This number is an integer in the range
[0, 9].You can also use the shortcut member
minor_version_number- Returns:
Minor version number.
- Return type:
int
- HxVersion.get_build_date()¶
Returns Hexaly Optimizer build date. This number is an integer
YYYYMMDDwithYYYYthe year,MMthe month,DDthe day.You can also use the shortcut member
build_date- Returns:
Build date
- Return type:
int
- HxVersion.get_platform()¶
Returns the platform of the Hexaly Optimizer binary as a string. The format of the string is
PPPPXXwherePPPPis the platform (Win, Linux or MacOS) andXXis the architecture (32 or 64 bits).You can also use the shortcut member
platform- Returns:
Platform as string.
- Return type:
str- Since:
3.0
- HxVersion.get_version()¶
Returns Hexaly Optimizer version as a string. The format of the string is:
MA.MI.YYYYMMDD-PPPPXXwithMAthe major number version,MIthe minor number version,YYYYthe year,MMthe month,DDthe day,PPPPthe platform (Win, Linux or MacOS) andXXthe architecture.You can also use the shortcut member
version- Returns:
Version as string
MA.MI.YYYYMMDD-PPPPXX.- Return type:
str
- HxVersion.get_version_code()¶
Returns Hexaly Optimizer version code as an integer in the range
[0, 29999]. The version code is computed as follows:MA * 10 + MIwithMAthe major number version,MIthe minor number version.You can also use the shortcut member
version_code- Returns:
Version code.
- Return type:
int
- HxVersion.get_copyright()¶
Returns Hexaly Optimizer copyright as a string.
You can also use the shortcut member
copyright- Returns:
Copyright notice.
- Return type:
str
- HxVersion.get_info()¶
Returns version and copyright info as a string.
You can also use the shortcut member
info- Returns:
Version and copyright info.
- Return type:
str
- HxVersion.get_license_path()¶
Returns the license path of Hexaly Optimizer. This path will be used for any new
HexalyOptimizerobject. Existing objects will not be affected the path change.This method returns the value specified by the user if
set_license_path()was called. Otherwise, a default value is returned. This default value is described at the top of this document.You can also use the shortcut member
license_path.- Returns:
Path to the license
- See:
- See:
- See:
- Since:
3.0
- HxVersion.set_license_path(path)¶
Change the license path used by Hexaly Optimizer. This path will be used for any new
HexalyOptimizerobject. Existing objects will not be affected by the path change.You can also use the shortcut member
license_path.- Parameters:
path (
str) – New path for the license- Since:
3.0
- HxVersion.get_license_content()¶
Returns the license content previously set with
set_license_content()or theHX_LICENSE_CONTENTenvironment variable. The license content will be used for all newHexalyOptimizerobject. Existing objects will not be affected by the change.You can also use the shortcut member
license_content.- Returns:
The content of the license or an empty string if the content was not set.
- Return type:
str- Since:
5.0
- HxVersion.set_license_content(content)¶
Change the license content that will be used for all new
HexalyOptimizerobjects. 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 = XXXXwhereXXXXis your license number. The content may include several lines.You can also use the shortcut member
license_content.- Parameters:
content (
str) – Content of the license to use.- Since:
5.0
- HxVersion.get_license_max_version_code()¶
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
HexalyOptimizerobject. It is determined according to the priority order defined at the top of this document.The version code is computed as follows:
MA * 10 + MIwithMAthe major number version,MIthe 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
- Return type:
int
- HxVersion.get_license_expiration_date()¶
Returns the expiration date of the current license. The current license is the one that will be used for any new
HexalyOptimizerobject. 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
- Return type:
datetime.datetime
Instance attributes¶
All get/set methods have their attribute counterpart. You can use them as
shortcuts to improve the readability or your models and codes.
- HxVersion.major_version_number¶
Major version number. This attribute is read-only. It is a shortcut for
get_major_version_number().
- HxVersion.minor_version_number¶
Minor version number. This attribute is read-only. It is a shortcut for
get_minor_version_number().
- HxVersion.build_date¶
Build date. This attribute is read-only. It is a shortcut for
get_build_date().
- HxVersion.platform¶
Platform of the Hexaly Optimizer binary. This attribute is read-only. It is a shortcut for
get_platform().
- HxVersion.version¶
Version as string. This attribute is read-only. It is a shortcut for
get_version().
- HxVersion.version_code¶
Version code. This attribute is read-only. It is a shortcut for
get_version_code().
- HxVersion.copyright¶
Hexaly Optimizer copyright. This attribute is read-only. It is a shortcut for
get_copyright().
- HxVersion.info¶
Version and copyright info. This attribute is read-only. It is a shortcut for
get_info().
- HxVersion.license_path¶
License path. It is a shortcut for
get_license_path()andset_license_path().
- HxVersion.license_content¶
License content. It is a shortcut for
get_license_content()andset_license_content().- Since:
5.0
- HxVersion.license_max_version_code¶
Code of the maximum version supported by the current license. It is a shortcut for
get_license_max_version_code().- Since:
14.0
- HxVersion.license_expiration_date¶
Expiration date of the current license. It is a shortcut for
get_license_expiration_date().- Since:
14.0