【问题标题】:Size of integers in CPLEXCPLEX 中的整数大小
【发布时间】:2025-12-17 01:20:05
【问题描述】:

我尝试了相当多的搜索,但找不到答案。 CPLEX 中整数变量的大小是多少?是 64 位还是基于边界的任意精度?

【问题讨论】:

  • 为什么不试试 sizeof(IloInt) ?
  • @Tryer 我在 python 中工作,python 具有任意精度整数。但是,是的,我应该看看其他语言的 API。那应该已经清除了。

标签: linear-programming cplex docplex


【解决方案1】:
public  IloIntVar(IloEnv env, IloInt vmin=0, IloInt vmax=IloIntMax, const char * name=0)

整数决策变量的最大值是 IloIntMax

PS:

dvar int x;

subject to
{
  
}

execute
{
  writeln(x.UB);
}

给出确切的值

2147483647

【讨论】:

  • 这不是 OP 所要求的。问题是,sizeof(IloInt) 会返回什么?
【解决方案2】:

concert/include/ilconcert/ilosys.h 中的代码

typedef __int64 IloInt;
typedef unsigned __int64 IloUInt;
typedef long IloInt;
typedef unsigned long IloUInt;
typedef double IloNum;
typedef float IloShortNum;
typedef IloInt IloBool;
typedef void* ILO_MAY_ALIAS IloAny;
typedef IloNum (*IloNumFunction)(IloNum);

IloNum 是双倍

IloBool/IloInt 都很长

【讨论】: