跳至主内容
框架 无框架

宏ILOBRANCHCALLBACK0

定义文件: ilcplex/ilocplex.h
ILOBRANCHCALLBACK0(name)
ILOBRANCHCALLBACK1(name, type1, x1)
ILOBRANCHCALLBACK2(name, type1, x1, type2, x2)
ILOBRANCHCALLBACK3(name, type1, x1, type2, x2, type3, x3)
ILOBRANCHCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)
ILOBRANCHCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)
ILOBRANCHCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5, type6, x6)
ILOBRANCHCALLBACK7(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5, type6, x6, type7, x7)

该宏创建了两个内容:一个是名为 "nameI的用户自定义回调的实现类,另一个是名为 "name的函数,用于创建该类的实例并返回一个句柄,即 "IloCplex::Callback的实例。 调用该函数时,需要将环境作为第一个参数,然后再调用宏执行时指定的 n 个参数,以便创建回调。 You can then use the callback by passing it to the use method of an IloCplex object.

宏创建的类 "nameI包含回调所需的方法 "duplicateCallback的实现。 用户必须在大括号 {} 中提供 "main方法的实现,并且必须跟在宏调用之后,就像这样:

 ILOBRANCHCALLBACKn(name, ...) {

 // 实现回调

 }

在执行回调时,可以使用 "IloCplex::BranchCallbackI类及其父类中的方法。

您不必使用该宏来定义回调。 如果宏的限制性太大,您可以直接定义回调类。 由于参数 "name用于命名回调类,因此无法在多个回调定义中使用相同的名称。

另请参阅: