*本文主要记录和分享学习到的知识,算不上原创

*参考文献见链接

本文主要归纳了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的更多相关文章

  1. Cplex: MIP Control Callback

    *本文主要记录和分享学习到的知识,算不上原创 *参考文献见链接 之前,我们有简单提到Cplex中的MIP Callback Interface,包括了Informational callback, q ...

  2. Cplex: MIP Callback Interface

    *本文主要记录和分享学习到的知识,算不上原创 *参考文献见链接 这篇文章主要记录一些Cplex的Callback的使用方法,采用Java语言. https://www.ibm.com/support/ ...

  3. Tutorial: WPF User Control for AX2012

    原作者: https://community.dynamics.com/ax/b/goshoom/archive/2011/10/06/tutorial-wpf-user-control-for-ax ...

  4. Android图形系统之Surface、SurfaceView、SurfaceHolder及SurfaceHolder.Callback之间的联系

    1.Surface Surface extends Objectimplements Parcelable java.lang.Object    ↳ android.view.Surface Cla ...

  5. 【Leafletjs】5.L.Control 自定义一个Control

    L.Control 所有leaflet控制的基础类.继承自IControl接口. 你可以这样添加控件: control.addTo(map); // the same as map.addContro ...

  6. 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 ...

  7. A Complete ActiveX Web Control Tutorial

    A Complete ActiveX Web Control Tutorial From: https://www.codeproject.com/Articles/14533/A-Complete- ...

  8. 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 ...

  9. java多线程系类:JUC线程池:03之线程池原理(二)(转)

    概要 在前面一章"Java多线程系列--"JUC线程池"02之 线程池原理(一)"中介绍了线程池的数据结构,本章会通过分析线程池的源码,对线程池进行说明.内容包 ...

随机推荐

  1. ADC5513

    一 C5513 u32 ADC5513_GetValue(void){  u32 ADValue,i;  bool data_bit = false;   C5513_SCK=0;  C5513_CS ...

  2. POJ 3735 Training little cats 矩阵快速幂

    http://poj.org/problem?id=3735 给定一串操作,要这个操作连续执行m次后,最后剩下的值. 记矩阵T为一次操作后的值,那么T^m就是执行m次的值了.(其实这个还不太理解,但是 ...

  3. python实现批量远程执行命令及批量上传下载文件

    #!/usr/bin/env python # -*- coding: utf- -*- # @Time : // : # @Author : xuxuedong # @Site : # @File ...

  4. LINUX中IPTABLES防火墙使用

    对于有公网IP的生产环境VPS,仅仅开放需要的端口,即采用ACL来控制IP和端口(Access Control List). 这里可以使用Linux防火墙netfilter的用户态工具 iptable ...

  5. 字节码技术---------动态代理,lombok插件底层原理。类加载器

    字节码技术应用场景 AOP技术.Lombok去除重复代码插件.动态修改class文件等 字节技术优势  Java字节码增强指的是在Java字节码生成之后,对其进行修改,增强其功能,这种方式相当于对应用 ...

  6. 在CentOS7上源码安装php7--Install php7 from source on CentOS7

    首先下载php源码包并解压: # wget http://cn2.php.net/get/php-7.0.9.tar.gz/from/this/mirror # .tar.gz # cd php- 然 ...

  7. [Loading Component]Loading组件的v-model设计是否不合理?

    vue在2.4.2版本中给computed里的属性加了限制,详见assigning to a computed property without setter does not fail 项目将vue ...

  8. mysqldatadir 转移

    当mysql data路径与原始目录不一致时 ,请在mysql 安装目录下my-default.ini 进行设置,取消对应#注释的地址,设置新地址,保存,重新启动,即可. 从网上各种搜索啊,各种尝试, ...

  9. 本号讯 | 微软和百度携手推进全球自动驾驶技术; 微软发布新一代可垂直可水平滚动的Arc鼠标

    7 月 13 日,微软宣布了与宝马的最新合作进展,继语音助手 Cortana .云服务 Azure.Office 365 和微软 Exchange 安装在部分宝马车型后——Skype for Busi ...

  10. python3发送邮件01(简单例子,不带附件)

    # -*- coding:utf-8 -*-import smtplibfrom email.header import Headerfrom email.mime.text import MIMET ...