跳至主内容
框架 无框架

宏ILOCONTINUOUSCALLBACK0

定义文件: ilcplex/ilocplex.h
ILOCONTINUOUSCALLBACK0(name)
ILOCONTINUOUSCALLBACK1(name, type1, x1)
ILOCONTINUOUSCALLBACK2(name, type1, x1, type2, x2)
ILOCONTINUOUSCALLBACK3(name, type1, x1, type2, x2, type3, x3)
ILOCONTINUOUSCALLBACK4(name, type1, x1, type2, x2, type3, x3, type4, x4)
ILOCONTINUOUSCALLBACK5(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5)
ILOCONTINUOUSCALLBACK6(name, type1, x1, type2, x2, type3, x3, type4, x4, type5, x5, type6, x6)
ILOCONTINUOUSCALLBACK7(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方法的实现,并且必须跟在宏调用之后,就像这样:

 ILOCONTINUOUSCALLBACKn(name, ...) {

 // 实现回调

 }

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

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

另请参阅: