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之 线程池原理(一)"中介绍了线程池的数据结构,本章会通过分析线程池的源码,对线程池进行说明.内容包 ...
随机推荐
- 运行node提示:events.js:160 throw er; // Unhandled 'error' event
运行node时遇到下述提示: events.js:160 throw er; // Unhandled 'error' event或者events.js:160 throw er; // ...
- HDU 1069 Monkey and Banana DP LIS变形题
http://acm.hdu.edu.cn/showproblem.php?pid=1069 意思就是给定n种箱子,每种箱子都有无限个,每种箱子都是有三个参数(x, y, z)来确定. 你可以选任意两 ...
- Kaggle八门神器(一):竞赛神器之XGBoost介绍
Xgboost为一个十分有效的机器学习模型,在各种竞赛中均可以看到它的身影,同时Xgboost在工业届也有着广泛的应用,本文以Titanic数据集为研究对象,简单地探究Xgboost模型建模过程,同时 ...
- 《java学习三》jvm性能优化------jconsul
利用jconsul检测线程死锁, 死锁的线程,会有 已锁定 三个字 visualVm 也在jdk里 VisualVM 是一款免费的,集成了多 ...
- 【转】如何学习Javascript
首先要说明的是,咱现在不是高手,最多还是一个半桶水,算是入了JS的门. 谈不上经验,都是一些教训. 这个时候有人要说,“靠,你丫半桶水,凭啥教我们”.您先别急着骂,先听我说. 你叫一个大学生去教小学数 ...
- (办公)ssm发送邮件
1.添加jar包 <!-- Javamail API --> <dependency> <groupId>javax.mail</groupId> &l ...
- 使用 xib 设置 button 等款等高
很多时候需要使用平分的控件来布局,当然xib中可以之间使用 UIToolBar 使用 UIBarButtonItem 添加弹簧即可完成平均分布 但是,直接使用 button 也可以实现平均布局
- Android 下的 SQLite 操作封装 —— DatabaseUtil
看到别人写的代码不错,对自己目前的开发很有用,所以转载一下,希望也能帮助到其他人: 1.DatabaseUtil.java(封装的类) package com.dbexample; import an ...
- Spring RestTemplate实现服务间的远程调用完整代码示例
父pom: 服务提供方 pom: provider配置文件: provider启动类: provider实体类: provider Mapper: 内置了增删改查的方法 provider Servic ...
- 【js类库Raphaël】使用raphael.js根据点坐标绘制平滑曲线
一.可供参考的文档资料. raphaeljs官网:http://raphaeljs.com/ w3c关于path的介绍:http://www.w3.org/TR/2003/REC-SVG11-200 ...