简体   繁体   English

如何在 CPLEX 中为 UBQP 获取多个解

[英]How to obtain multiple solutions in CPLEX for a UBQP

I have implemented a UBQP (that is a quadratic problem without constraints and with binary variables) in CPLEX (v 12.6.2) in the Callable Library in C and I'm interested in obtaining multiple solutions (not only the optimum, but also other feasible).我在 C 语言的 Callable 库中的 CPLEX (v 12.6.2) 中实现了一个 UBQP(这是一个没有约束和二进制变量的二次问题),我有兴趣获得多个解决方案(不仅是最佳的,还有其他的)可行)。

I took CPLEX original populate.cpp code and getting its routines in order to get a solution pool, such as CPXpopulate(env,lp).我采用了 CPLEX 原始的 populate.cpp 代码并获取其例程以获得解决方案池,例如 CPXpopulate(env,lp)。

The problem is that the size of my solution pool is always 1 , it only contains the optimum.问题是我的解决方案池的大小总是 1 ,它只包含最佳。 Instead, if I give to populate.cpp a LP problem (ie a minimization linear problem) it works correctly.相反,如果我给 populate.cpp 一个 LP 问题(即最小化线性问题),它可以正常工作。

I tried the usual commands:我尝试了通常的命令:

 status = CPXsetdblparam (env, CPXPARAM_MIP_Pool_RelGap, 0.5);
 status = CPXsetintparam (env, CPXPARAM_MIP_Pool_Capacity, 25);
 status = CPXsetintparam (env, CPXPARAM_MIP_Pool_Replace, 1);
 status = CPXsetdblparam (env,CPXPARAM_Simplex_Tolerances_Feasibility,0.01);    
 status = CPXsetdblparam (env, CPXPARAM_MIP_Tolerances_Integrality,   0.01);
status = CPXsetintparam (env, CPXPARAM_MIP_Pool_Intensity, N);

that should force CPLEX to generate more solutions, but it does not.这应该会强制 CPLEX 生成更多解,但事实并非如此。

If I set N = 4 (that is the max value) in CPXPARAM_MIP_Pool_Intensity it failed to optimize, but if set N = 0,...,3 I don't get more than 1 solution.如果我在 CPXPARAM_MIP_Pool_Intensity 中设置 N = 4(即最大值),它无法优化,但如果设置 N = 0,...,3 我不会得到超过 1 个解决方案。

Is there a way to obtain multiple solutions in such a kind of problem?有没有办法在这样的问题中获得多个解决方案?

为了使用 CPLEX 获得大量可行解,您应该使用 CPLEX.populate() 而不是 CPLEX.solve()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM