跳至主内容
框架 无框架

宏ILOSOLVECALLBACK0

定义文件: ilcplex/ilocplex.h
ILOSOLVECALLBACK0(name)
ILOSOLVECALLBACK1(name, type1, x1)
ILOSOLVECALLBACK2(name, type1, x1, type2, x2)
ILOSOLVECALLBACK3(name, type1, x1, type2, x2, type3, x3)
ILOSOLVECALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)
ILOSOLVECALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)
ILOSOLVECALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5, type6, x6)
ILOSOLVECALLBACK7(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方法的实现,并且必须跟在宏调用之后,就像这样:

 ILOSOLVECALLBACKn(name, ...) {

 // 实现回调

 }

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

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

另请参阅: