XPRSglobalenv
- java.lang.Object
-
- com.dashoptimization.XPRSobject
-
- com.dashoptimization.XPRSglobalenv
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public class XPRSglobalenv extends XPRSobject
Provides access to the global optimizer environment.
-
-
Method Summary
Modifier and Type Method Description void
addMsgHandlerListener(XPRSmsgHandlerListener listener)
Add a listener for the MsgHandler callback.void
addMsgHandlerListener(XPRSmsgHandlerListener listener, int priority)
Add a listener for the MsgHandler callback.void
addMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data)
Add a listener for the MsgHandler callback.void
addMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data, int priority)
Add a listener for the MsgHandler callback.static boolean
beginLicensing()
void
close()
The Global Environment is destroyed byXPRS.free()
so thisclose()
function does nothing.static void
endLicensing()
void
featureQuery(java.lang.String feature, IntHolder p_status)
Checks if the provided feature is available in the current license used by the optimizer.java.lang.String
getBanner()
Convenience wrapper forgetBanner(com.dashoptimization.StringHolder)
.void
getBanner(StringHolder banner)
Returns the banner and copyright message.boolean
getCheckedMode()
Convenience wrapper forgetCheckedMode(com.dashoptimization.BoolHolder)
.void
getCheckedMode(BoolHolder p_checkedmode)
You can use this function to interrogate whether checking and validation of all Optimizer function calls is enabled for the current process.XPRSenumerations.AllowCompute
getComputeAllowed()
Query whether the current application is allowed to use the Insight Compute interface.int
getDaysLeft()
Convenience wrapper forgetDaysLeft(com.dashoptimization.IntHolder)
.void
getDaysLeft(IntHolder p_daysleft)
Returns the number of days left until the license expires.void
getDebugMode(IntHolder p_debugmode)
java.lang.String
getLastError()
Returns the last error encountered during a call to the Xpress global environment.java.lang.String
getLastError(IntHolder p_msgcode)
Returns the last error encountered during a call to the Xpress global environment.void
getSafeMode(IntHolder p_safemode)
static java.lang.String
getVersion()
Convenience wrapper forgetVersion(com.dashoptimization.StringHolder)
.static void
getVersion(StringHolder version)
Returns the full Optimizer version number in the form 15.10.03, where 15 is the major release, 10 is the minor release, and 03 is the build number.static void
getVersionNumbers(IntHolder p_major, IntHolder p_minor, IntHolder p_build)
Returns the Optimizer version numbers split into major, minor, and build number.static int
license(IntHolder p_i)
Convenience wrapper forlicense(com.dashoptimization.IntHolder, com.dashoptimization.StringHolder)
.static int
license(IntHolder p_i, StringHolder p_c)
void
removeMsgHandlerListener()
Deprecated.void
removeMsgHandlerListener(XPRSmsgHandlerListener listener)
Removes the given MsgHandler listener from the object.void
removeMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data)
Removes the given MsgHandler listener with the given data value from the object.void
removeMsgHandlerListeners()
Remove all listeners for the MsgHandler callbackvoid
setArchConsistency(int consistent)
Sets whether to force the same execution path on various CPU architecture extensions, in particular (pre-)AVX and AVX2.void
setCheckedMode(boolean checkedmode)
You can use this function to disable some of the checking and validation of function calls and function call parameters for calls to the Xpress Optimizer API.void
setComputeAllowed(XPRSenumerations.AllowCompute allow)
Set whether the current application is allowed to use the Insight Compute interface.void
setDebugMode(int debugmode)
void
setSafeMode(int safemode)
-
Methods inherited from class com.dashoptimization.XPRSobject
addMsgHandlerListener, addMsgHandlerListener, destroy, isDestroyed
-
-
-
-
Method Detail
-
close
public void close() throws XPRSexception
The Global Environment is destroyed byXPRS.free()
so thisclose()
function does nothing.- Specified by:
-
close
in interfacejava.lang.AutoCloseable
- Specified by:
-
close
in classXPRSobject
- Throws:
-
XPRSexception
- Since:
- 38
-
license
public static int license(IntHolder p_i, StringHolder p_c) throws XPRSexception
- Throws:
-
XPRSexception
-
license
public static int license(IntHolder p_i) throws XPRSexception
Convenience wrapper forlicense(com.dashoptimization.IntHolder, com.dashoptimization.StringHolder)
.
-
beginLicensing
public static boolean beginLicensing() throws XPRSexception
- Throws:
-
XPRSexception
-
endLicensing
public static void endLicensing() throws XPRSexception
- Throws:
-
XPRSexception
-
setCheckedMode
public void setCheckedMode(boolean checkedmode) throws XPRSexception
You can use this function to disable some of the checking and validation of function calls and function call parameters for calls to the Xpress Optimizer API. This checking is relatively lightweight but disabling it can improve performance in cases where non-intensive Xpress Optimizer functions are called repeatedly in a short space of time. Please note: after disabling function call checking and validation, invalid usage of Xpress Optimizer functions may not be detected and may cause the Xpress Optimizer process to behave unexpectedly or crash. It is not recommended that you disable function call checking and validation during application development.- Parameters:
-
checkedmode
- Pass as 0 to disable much of the validation for all Xpress function calls from the current process. Pass 1 to re-enable validation. By default, validation is enabled. - Throws:
-
XPRSexception
-
getCheckedMode
public void getCheckedMode(BoolHolder p_checkedmode) throws XPRSexception
You can use this function to interrogate whether checking and validation of all Optimizer function calls is enabled for the current process. Checking and validation is enabled by default but can be disabled bysetCheckedMode
.- Parameters:
-
p_checkedmode
- Variable that is set to 0 if checking and validation of Optimizer function calls is disabled for the current process, non-zero otherwise. - Throws:
-
XPRSexception
-
getCheckedMode
public boolean getCheckedMode() throws XPRSexception
Convenience wrapper forgetCheckedMode(com.dashoptimization.BoolHolder)
.- Returns:
-
The value that would be returned by
getCheckedMode(com.dashoptimization.BoolHolder)
as output parameter. - Throws:
-
XPRSexception
- See Also:
-
getCheckedMode(com.dashoptimization.BoolHolder)
-
getBanner
public void getBanner(StringHolder banner) throws XPRSexception
Returns the banner and copyright message.- Parameters:
-
banner
- A buffer of at leastXPRS_MAXBANNERLENGTH
characters in which the null terminated banner string will be returned. - Throws:
-
XPRSexception
-
getBanner
public java.lang.String getBanner() throws XPRSexception
Convenience wrapper forgetBanner(com.dashoptimization.StringHolder)
.- Returns:
-
The value that would be returned by
getBanner(com.dashoptimization.StringHolder)
as output parameter. - Throws:
-
XPRSexception
- See Also:
-
getBanner(com.dashoptimization.StringHolder)
-
getVersion
public static void getVersion(StringHolder version) throws XPRSexception
Returns the full Optimizer version number in the form 15.10.03, where 15 is the major release, 10 is the minor release, and 03 is the build number.- Parameters:
-
version
- Buffer long enough to hold the version string (plus a null terminator). This should be at least 16 characters. - Throws:
-
XPRSexception
-
getVersion
public static java.lang.String getVersion() throws XPRSexception
Convenience wrapper forgetVersion(com.dashoptimization.StringHolder)
.- Returns:
-
The value that would be returned by
getVersion(com.dashoptimization.StringHolder)
as output parameter. - Throws:
-
XPRSexception
- See Also:
-
getVersion(com.dashoptimization.StringHolder)
-
getVersionNumbers
public static void getVersionNumbers(IntHolder p_major, IntHolder p_minor, IntHolder p_build) throws XPRSexception
Returns the Optimizer version numbers split into major, minor, and build number.- Parameters:
-
p_major
- Pointer to integer to receive the major version number. Can benull
. -
p_minor
- Pointer to integer to receive the minor version number. This is a number from 0 to 99. Can benull
. -
p_build
- Pointer to integer to receive the build number. This is a number from 0 to 99. Can benull
. - Throws:
-
XPRSexception
-
getDaysLeft
public void getDaysLeft(IntHolder p_daysleft) throws XPRSexception
Returns the number of days left until the license expires.- Parameters:
-
p_daysleft
- Pointer to an integer where the number of days is to be returned. For a permanent license, the return value will beXPRS_MAXINT
- Throws:
-
XPRSexception
-
getDaysLeft
public int getDaysLeft() throws XPRSexception
Convenience wrapper forgetDaysLeft(com.dashoptimization.IntHolder)
.- Returns:
-
The value that would be returned by
getDaysLeft(com.dashoptimization.IntHolder)
as output parameter. - Throws:
-
XPRSexception
- See Also:
-
getDaysLeft(com.dashoptimization.IntHolder)
-
featureQuery
public void featureQuery(java.lang.String feature, IntHolder p_status) throws XPRSexception
Checks if the provided feature is available in the current license used by the optimizer.- Parameters:
-
feature
- The feature string to be checked in the license. -
p_status
- Return status of the check, a value of 1 indicates the feature is available. - Throws:
-
XPRSexception
-
setArchConsistency
public void setArchConsistency(int consistent) throws XPRSexception
Sets whether to force the same execution path on various CPU architecture extensions, in particular (pre-)AVX and AVX2.- Parameters:
-
consistent
- Whether to force the same execution path:0
: Do not force the same execution path (default behavior);1
: Force the same execution path.
- Throws:
-
XPRSexception
-
setSafeMode
public void setSafeMode(int safemode) throws XPRSexception
- Throws:
-
XPRSexception
-
getSafeMode
public void getSafeMode(IntHolder p_safemode) throws XPRSexception
- Throws:
-
XPRSexception
-
setDebugMode
public void setDebugMode(int debugmode) throws XPRSexception
- Throws:
-
XPRSexception
-
getDebugMode
public void getDebugMode(IntHolder p_debugmode) throws XPRSexception
- Throws:
-
XPRSexception
-
getLastError
public java.lang.String getLastError() throws XPRSexception
Returns the last error encountered during a call to the Xpress global environment.- Specified by:
-
getLastError
in classXPRSobject
- Returns:
- The requested information.
- Throws:
-
XPRSexception
-
getLastError
public java.lang.String getLastError(IntHolder p_msgcode) throws XPRSexception
Returns the last error encountered during a call to the Xpress global environment.- Parameters:
-
p_msgcode
- Memory location in which the error code will be returned. Can be null if not required. - Returns:
- The requested information.
- Throws:
-
XPRSexception
-
setComputeAllowed
public void setComputeAllowed(XPRSenumerations.AllowCompute allow) throws XPRSexception
Set whether the current application is allowed to use the Insight Compute interface.- Parameters:
-
allow
- Whether the Insight Compute interface may be used; must be one of the following constants:XPRS_ALLOW_COMPUTE_ALWAYS
: Always allow solves to be sent to Compute.XPRS_ALLOW_COMPUTE_NEVER
: Never allow solves to be sent to Compute.XPRS_ALLOW_COMPUTE_DEFAULT
: Allow solves to be sent to Compute only from non-OEM applications.
- Throws:
-
XPRSexception
-
getComputeAllowed
public XPRSenumerations.AllowCompute getComputeAllowed() throws XPRSexception
Query whether the current application is allowed to use the Insight Compute interface.- Returns:
-
Value will equal one of the following constants.
XPRS_ALLOW_COMPUTE_ALWAYS
: Always allow solves to be sent to Compute.XPRS_ALLOW_COMPUTE_NEVER
: Never allow solves to be sent to Compute.XPRS_ALLOW_COMPUTE_DEFAULT
: Allow solves to be sent to Compute only from non-OEM applications.
- Throws:
-
XPRSexception
-
addMsgHandlerListener
public void addMsgHandlerListener(XPRSmsgHandlerListener listener) throws XPRSexception
Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.- Specified by:
-
addMsgHandlerListener
in classXPRSobject
- Parameters:
-
listener
- The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.) - Throws:
-
XPRSexception
-
addMsgHandlerListener
public void addMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data) throws XPRSexception
Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.- Specified by:
-
addMsgHandlerListener
in classXPRSobject
- Parameters:
-
listener
- The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.) -
data
- An additional object which will be passed down to the callback function - Throws:
-
XPRSexception
-
addMsgHandlerListener
public void addMsgHandlerListener(XPRSmsgHandlerListener listener, int priority) throws XPRSexception
Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.- Parameters:
-
listener
- The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.) -
priority
- Listeners with higher priorities are called first - Throws:
-
XPRSexception
-
addMsgHandlerListener
public void addMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data, int priority) throws XPRSexception
Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.- Parameters:
-
listener
- The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.) -
data
- An additional object which will be passed down to the callback function -
priority
- Listeners with higher priorities are called first - Throws:
-
XPRSexception
-
removeMsgHandlerListener
public void removeMsgHandlerListener(XPRSmsgHandlerListener listener) throws XPRSexception
Removes the given MsgHandler listener from the object.- Parameters:
-
listener
- The listener to remove. - Throws:
-
XPRSexception
-
removeMsgHandlerListener
public void removeMsgHandlerListener(XPRSmsgHandlerListener listener, java.lang.Object data) throws XPRSexception
Removes the given MsgHandler listener with the given data value from the object.- Parameters:
-
listener
- The listener to remove. -
data
- The user data to remove. - Throws:
-
XPRSexception
-
removeMsgHandlerListener
@Deprecated public void removeMsgHandlerListener() throws XPRSexception
Deprecated.Removes all MsgHandler listeners from the object. @deprecated as of Xpress 7.1, please useremoveMsgHandlerListener(XPRSmsgHandlerListener)
orremoveMsgHandlerListeners()
- Specified by:
-
removeMsgHandlerListener
in classXPRSobject
- Throws:
-
XPRSexception
-
removeMsgHandlerListeners
public void removeMsgHandlerListeners() throws XPRSexception
Remove all listeners for the MsgHandler callback- Throws:
-
XPRSexception
-
-
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.