Cplex: MIP Control Callback Methods
*本文主要记录和分享学习到的知识,算不上原创
*参考文献见链接
本文主要归纳了Cplex的Control callback常用的方法。
目录
NodeCallback
SolveCallback
UserCutCallback
LazyConstraintCallback
HeuristicCallback
BranchCallback
IncumbentCallback
Control CallBack Interface
If you determine that your application needs to seize control, intervene in the search, and redirect the optimizer, then the following control callbacks are available to do so.
The node callback allows you to query and optionally overwrite the next node CPLEX will process during a branch & cut search.
IloCplex.NodeCallback in the Java API
The solve callback allows you to specify and configure the optimizer option to be used for solving the LP at each individual node.
IloCplex.SolveCallback in the Java API
The user cut callback allows you to add problem-specific user-defined cuts at each node.
IloCplex.UserCutCallback in the Java API
The lazy constraint callback allows you to add lazy constraints; that is, constraints that are not evaluated unless they are violated.
IloCplex.LazyConstraintCallback in the Java API
The heuristic callback allows you to implement a heuristic that tries to generate a new incumbent from the solution of the LP relaxation at each node.
IloCplex.HeuristicCallback in the Java API
The branch callback allows you to query and optionally overwrite the way CPLEX will branch at each node.
IloCplex.BranchCallback in the Java API
The incumbent callback allows you to check and optionally reject incumbents found by CPLEX during the search.
IloCplex.IncumbentCallback in the Java API
In Java, there is no way of removing individual callbacks from yourIloCplexorCplexobject. Instead, you remove all callbacks by calling the methodIloCplex.clearCallbacksorCplexClearCallbacks.
Node Callback
getBranchVar(long node) Returns the variable that was branched upon to create the node specified by number node.
getDepth(long node) Returns the depth of the node in the search tree.
getNodeId(long node) Returns the node identifier of the node specified by the node number node.
getNodeNumber(IloCplex.NodeId nodeid) Returns the node number of the node specified by the node identifier.
getObjValue(long node) Returns the objective value of the node specified by the node number.
selectNode(long node) Selects the next node to be processed by its number.
Solve Callback
setStart() Specifies a starting point for the next invocation of the method solve during the current solve callback.
solve() Solves the current node using the default algorithm (IloCplex.Algorithm.Auto).
solve(int alg) Solves the current node using the algorithm alg.
useSolution() Instructs IloCplex to use a solution.
** This method instructs IloCplex to use the solution generated with this callback instead of solving the node itself.
Heuristic Callback
setBounds() Sets the bounds for a set of variables.
setSolution() Sets a solution to be used as the incumbent.
User Cut Callback
add() Adds a linear global cut to the current subproblem.
**This cut must be globally valid. It will not be removed by backtracking or any other means during the search. The cut must also not cut off any integer feasible solution.
addLocal() Adds a linear local cut to the current subproblem.
isAfterCutLoop() Returns True if called after the cut loop, False otherwise.
abortCutLoop() Terminate the cut loop and proceed with branching.
Lazy Constraint Callback
add(IloRange cut) Adds a linear consraint cut as a global lazy constraint to the problem being solved.
** As a lazy constraint, this cut must be globally valid. It will not be removed by backtracking or any other means during the search.
addLocal(IloRange cut) Adds cut as a local lazy constraint to the problem being solved.
isUnboundedNode() This method indicates whether or not the callback was invoked when the LP relaxation is found to be unbounded and the user needs to test whether a lazy constraint cuts off the unbounded direction.
Branch Callback
getBranches() Returns one of the candidate branches at the current node if not overridden by the invoking callback.
getBranchType() Returns the type of the branch at the current node unless overridden by the invoking callback.
getNbranches() Returns the number of branches CPLEX is going to create at the current node unless overridden by the invoking callback.
getNodeId() Returns the node identifier of the current node.
isIntegerFeasible() Returns true if the current node solution is considered to be integer feasible and thus potentially eligible as a new incumbent, but not suitable for branching.
makeBranch() Creates a child node for the current node
prune() Removes the current node from the search tree.
Incumbent Callback
getObjValue() Returns the objective value of the potential incumbent.
reject() Rejects the proposed incumbent solution.
Some other methods
setBounds Sets the bounds for a set of variables.
setSolution Sets a solution to be used as the incumbent.
Abort Aborts current optimization.
GetBestObjValue This method returns a bound on the optimal solution value of the active problem at the moment the callback is called.
GetCplexStatus Returns the Cplex.CplexStatus for the current node.
GetCplexTime This method returns a time stamp, useful in measuring elapsed time in seconds. elapsed time=end time-start time
GetCutoff Returns the cutoff for the objective value when nodes are being solved during branch-and-cut search.
GetEndTime This method returns a time stamp specifying when the time limit will occur. remaining time=getEndTime-getCplexTime
GetIncumbentObjValue Returns the objective value of the current best integer solution at the moment the callback is called. (incumbent: best integer feasible solution)
GetModel Returns the model being solved when the invoking callback is called, that is the active model.
GetNiterations Returns the total number of iterations for solving node relaxations during the current optimization.
GetNnodes Returns the number of nodes processed so far in the active branch-and-cut search.
GetNremainingNodes Returns the number of nodes remaining to be processed, or, equivalently, the number of active nodes in the tree.
GetObjValue Returns the objective function value of the solution of the continuous relaxation of the current node.
GetStartTime This method returns a time stamp specifying when the solving process was started.
GetStatus Returns the solution status for the current node.
HasIncumbent Returns true if an incumbent solution has been found when the callback is called.
Main The method to be implemented by user callback classes.
Solve Solves the current node relaxation using the default algorithm.
Cplex: MIP Control Callback Methods的更多相关文章
- Cplex: MIP Control Callback
*本文主要记录和分享学习到的知识,算不上原创 *参考文献见链接 之前,我们有简单提到Cplex中的MIP Callback Interface,包括了Informational callback, q ...
- Cplex: MIP Callback Interface
*本文主要记录和分享学习到的知识,算不上原创 *参考文献见链接 这篇文章主要记录一些Cplex的Callback的使用方法,采用Java语言. https://www.ibm.com/support/ ...
- Tutorial: WPF User Control for AX2012
原作者: https://community.dynamics.com/ax/b/goshoom/archive/2011/10/06/tutorial-wpf-user-control-for-ax ...
- Android图形系统之Surface、SurfaceView、SurfaceHolder及SurfaceHolder.Callback之间的联系
1.Surface Surface extends Objectimplements Parcelable java.lang.Object ↳ android.view.Surface Cla ...
- 【Leafletjs】5.L.Control 自定义一个Control
L.Control 所有leaflet控制的基础类.继承自IControl接口. 你可以这样添加控件: control.addTo(map); // the same as map.addContro ...
- Overview of Form Control Types [AX 2012]
Overview of Form Control Types [AX 2012] Other Versions 0 out of 1 rated this helpful - Rate this to ...
- A Complete ActiveX Web Control Tutorial
A Complete ActiveX Web Control Tutorial From: https://www.codeproject.com/Articles/14533/A-Complete- ...
- Spring Bean Life Cycle Methods – InitializingBean, DisposableBean, @PostConstruct, @PreDestroy and *Aware interfaces
Spring Beans are the most important part of any Spring application. Spring ApplicationContext is res ...
- java多线程系类:JUC线程池:03之线程池原理(二)(转)
概要 在前面一章"Java多线程系列--"JUC线程池"02之 线程池原理(一)"中介绍了线程池的数据结构,本章会通过分析线程池的源码,对线程池进行说明.内容包 ...
随机推荐
- Linux用脚本守护进程
while true; do server=`ps -aux | grep tomcat | grep -v grep` if [ ! "$server" ]; then echo ...
- 微服务实践分享(2)api网关
1.作用[http://chuansong.me/n/465796751848]: 一个完整的.「面向接入」的API GW需要包含以下功能: 面向运行期 对客户端实现身份认证 通信会话的秘钥协商,报文 ...
- 洛谷-P3927 SAC E#1 - 一道中档题 Factorial
原址 题目背景 数据已修改 SOL君(炉石主播)和SOL菌(完美信息教室讲师)是好朋友. 题目描述 SOL君很喜欢阶乘.而SOL菌很喜欢研究进制. 这一天,SOL君跟SOL菌炫技,随口算出了n的阶乘. ...
- SQL Server开窗函数之OVER子句、PARTITION BY 子句
开窗函数与聚合函数一样,都是对行的集合组进行聚合计算.它用于为行定义一个窗口(这里的窗口是指运算将要操作的行的集合),它对一组值进行操作,不需要使用GROUP BY子句对数据进行分组,能够在同一行中同 ...
- mysql(数据库,sql语句,普通查询)
第1章 数据库 1.1 数据库概述 l 什么是数据库 数据库就是存储数据的仓库,其本质是一个文件系统,数据按照特定的格式将数据存储起来,用户可以对数据库中的数据进行增加,修改,删除及查询操作. l 什 ...
- java实现按对象某个字段排序,排序字段和规则自定义
@SuppressWarnings({ "unchecked", "rawtypes" }) private <T> void sort(List& ...
- 零基础逆向工程11_C语言05_结构体
结构体小结 结构体是按照分配的大小,局部变量会自动数据对齐 1字节对齐,省空间,但cpu查找效率低 4字节对齐,不省空间,但cpu查找效率高 VC6默认的结构对齐大小 项目右键-> settin ...
- eclipse3.4+对的处理插件(附SVN插件安装实例)
Eclipse 3.4以前安装插件无非有两种方式, 直接copy插件到features/plugins目录或者在links目录下创建链接文件. Eclipse 3.4又推出另一种新的安装途径, 更加灵 ...
- SpringBoot LogBack文件配置
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true&q ...
- acdream 小晴天老师系列——我有一个数列! (ST算法)
小晴天老师系列——我有一个数列! Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)S ...