XPRSbranchobject
- java.lang.Object
-
- com.dashoptimization.XPRSobject
-
- com.dashoptimization.XPRSbranchobject
-
- All Implemented Interfaces:
- java.lang.AutoCloseable
public class XPRSbranchobject extends XPRSobject
Class encapsulating a branch object
-
-
Method Summary
Modifier and Type Method and Description void
addBounds(int branch, int nbounds, byte[] bndtype, int[] colind, double[] bndval)
Adds new bounds to a branch of a user branching object.void
addBranches(int nbranches)
Adds new, empty branches to a user defined branching object.void
addCuts(int branch, int ncuts, XPRScut[] cutind)
Adds stored user cuts as new constraints to a branch of a user branching object.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.void
addRows(int branch, int nrows, int ncoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef)
Adds new constraints to a branch of a user branching object.void
close()
Deallocates resources associated with an XPRSobject.int
getBounds(int branch)
Convenience wrapper forgetBounds(int, IntHolder, int, byte[], int[], double[])
.int
getBounds(int branch, int maxbounds, byte[] bndtype, int[] colind, double[] bndval)
Convenience wrapper forgetBounds(int, IntHolder, int, byte[], int[], double[])
.int
getBranches()
Convenience wrapper forgetBranches(IntHolder)
.void
getID(IntHolder p_id)
Returns the unique identifier assigned to a branching object.java.lang.String
getLastError()
Convenience wrapper forgetLastError(IntHolder, StringHolder, int, IntHolder)
.java.lang.String
getLastError(IntHolder p_msgcode)
Convenience wrapper forgetLastError(IntHolder, StringHolder, int, IntHolder)
.int
getRows(int branch)
Convenience wrapper forgetRows(int, IntHolder, int, IntHolder, int, byte[], double[], int[], int[], double[])
.int
getRows(int branch, int maxrows, IntHolder p_ncoefs, int maxcoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef)
Convenience wrapper forgetRows(int, IntHolder, int, IntHolder, int, byte[], double[], int[], int[], double[])
.void
removeMsgHandlerListener()
Removes all MsgHandler listeners from the object.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
setPreferredBranch(int branch)
Specifies which of the child nodes corresponding to the branches of the object should be explored first.void
setPriority(int priority)
Sets the priority value of a user branching object.int
store()
Commits the branch object to the XPRSprob.void
validate(IntHolder p_status)
Verifies that a given branching object is valid for branching on the current branch-and-bound node of a MIP solve.-
Methods inherited from class com.dashoptimization.XPRSobject
addMsgHandlerListener, addMsgHandlerListener, destroy, isDestroyed
-
-
-
-
Method Detail
-
store
public int store() throws XPRSexception
Commits the branch object to the XPRSprob. Note that the XPRSbranchobject will be invalidated when store() returns.- Throws:
-
XPRSexception
-
close
public void close()
Description copied from class:XPRSobject
Deallocates resources associated with an XPRSobject.- Specified by:
-
close
in interfacejava.lang.AutoCloseable
- Specified by:
-
close
in classXPRSobject
-
addBranches
public void addBranches(int nbranches) throws XPRSexception
Adds new, empty branches to a user defined branching object.- Parameters:
-
nbranches
- Number of new branches to create. - Throws:
-
XPRSexception
-
getBranches
public int getBranches() throws XPRSexception
Convenience wrapper forgetBranches(IntHolder)
.- Throws:
-
XPRSexception
- See Also:
-
getBranches(IntHolder)
-
setPriority
public void setPriority(int priority) throws XPRSexception
Sets the priority value of a user branching object.- Parameters:
-
priority
- The new priority value to assign to the branching object, which must be a number from 0 to 1000. User branching objects are created with a default priority value of 500. - Throws:
-
XPRSexception
-
setPreferredBranch
public void setPreferredBranch(int branch) throws XPRSexception
Specifies which of the child nodes corresponding to the branches of the object should be explored first.- Parameters:
-
branch
- The number of the branch to mark as preferred. - Throws:
-
XPRSexception
-
addBounds
public void addBounds(int branch, int nbounds, byte[] bndtype, int[] colind, double[] bndval) throws XPRSexception
Adds new bounds to a branch of a user branching object.- Parameters:
-
branch
- The number of the branch to add the new bounds for. This branch must already have been created using addBranches. Branches are indexed starting from zero. -
nbounds
- Number of new bounds to add. -
bndtype
- Character array of length nbounds indicating the type of bounds to add:- L: Lower bound.
- U: Upper bound.
-
colind
- Integer array of length nbounds containing the column indices for the new bounds. -
bndval
- Double array of length nbounds giving the bound values. - Throws:
-
XPRSexception
-
getBounds
public int getBounds(int branch, int maxbounds, byte[] bndtype, int[] colind, double[] bndval) throws XPRSexception
Convenience wrapper forgetBounds(int, IntHolder, int, byte[], int[], double[])
.- Throws:
-
XPRSexception
- See Also:
-
getBounds(int, IntHolder, int, byte[], int[], double[])
-
getBounds
public int getBounds(int branch) throws XPRSexception
Convenience wrapper forgetBounds(int, IntHolder, int, byte[], int[], double[])
.- Throws:
-
XPRSexception
- See Also:
-
getBounds(int, IntHolder, int, byte[], int[], double[])
-
addRows
public void addRows(int branch, int nrows, int ncoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef) throws XPRSexception
Adds new constraints to a branch of a user branching object.- Parameters:
-
branch
- The number of the branch to add the new constraints for. This branch must already have been created using addBranches. Branches are indexed starting from zero. -
nrows
- Number of new constraints to add. -
ncoefs
- Number of non-zero coefficients in all new constraints. -
rowtype
- Character array of length nrows indicating the type of constraints to add:- L: Less than type.
- G: Greater than type.
- E: Equality type.
-
rhs
- Double array of length nrows containing the right hand side values. -
start
- Integer array of length nrows containing the offsets of the colind and rowcoef arrays of the start of the non zero coefficients in the new constraints. -
colind
- Integer array of length ncoefs containing the column indices for the non zero coefficients. -
rowcoef
- Double array of length ncoefs containing the non zero coefficient values. - Throws:
-
XPRSexception
-
getRows
public int getRows(int branch, int maxrows, IntHolder p_ncoefs, int maxcoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef) throws XPRSexception
Convenience wrapper forgetRows(int, IntHolder, int, IntHolder, int, byte[], double[], int[], int[], double[])
.
-
getRows
public int getRows(int branch) throws XPRSexception
Convenience wrapper forgetRows(int, IntHolder, int, IntHolder, int, byte[], double[], int[], int[], double[])
.
-
addCuts
public void addCuts(int branch, int ncuts, XPRScut[] cutind) throws XPRSexception
Adds stored user cuts as new constraints to a branch of a user branching object.- Parameters:
-
branch
- The number of the branch to add the cuts for. This branch must already have been created using addBranches. Branches are indexed starting from zero. -
ncuts
- Number of cuts to add. -
cutind
- Array of length ncuts containing the pointers to user cuts that should be added to the branch. - Throws:
-
XPRSexception
-
getID
public void getID(IntHolder p_id) throws XPRSexception
Returns the unique identifier assigned to a branching object.- Parameters:
-
p_id
- Pointer to an integer where the identifier should be returned. - Throws:
-
XPRSexception
-
getLastError
public java.lang.String getLastError() throws XPRSexception
Convenience wrapper forgetLastError(IntHolder, StringHolder, int, IntHolder)
.- Specified by:
-
getLastError
in classXPRSobject
- Throws:
-
XPRSexception
- See Also:
-
getLastError(IntHolder, StringHolder, int, IntHolder)
-
getLastError
public java.lang.String getLastError(IntHolder p_msgcode) throws XPRSexception
Convenience wrapper forgetLastError(IntHolder, StringHolder, int, IntHolder)
.- Throws:
-
XPRSexception
- See Also:
-
getLastError(IntHolder, StringHolder, int, IntHolder)
-
validate
public void validate(IntHolder p_status) throws XPRSexception
Verifies that a given branching object is valid for branching on the current branch-and-bound node of a MIP solve. The function will check that all branches are non-empty, and if required, verify that the branching object can be presolved.- Parameters:
-
p_status
- The returned status from checking the provided branching object:- 0: The object is acceptable.
- 1: Failed to presolve the object due to dual reductions in presolve.
- 2: Failed to presolve the object due to duplicate column reductions in presolve.
- 3: The object contains an empty branch.
- 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.- 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.- Throws:
-
XPRSexception
-
removeMsgHandlerListener
public void removeMsgHandlerListener() throws XPRSexception
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-2021 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.