问题描述
在 or-tools 中使用 GLOP 时,使用 function shiftArray(array)
{
const elem = array.shift(); // remove the first element
array.push(elem); // push it to the end
// changes are made in place,nothing to return
}
function arrange(array,from,to)
{
// get the first part of the array
const firstpart = array.slice(0,from);
// get the part to do the "magic"
const partToShift = array.slice(from,to + 1);
// get the last part
const lastPart = array.slice(to + 1);
shiftArray(partToShift);
// return a new array,combining all parts
return firstpart.concat(partToShift,lastPart);
}
let before = ['❤ A','❤ 9','❤ 3','❤ 6','♣ A'];
let magics = arrange(before,1,-2);
console.log("original");
console.log(before);
console.log("modified");
console.log(magics);
// some edge cases
magics = arrange(before,-2);
console.log(magics);
magics = arrange(before,4);
console.log(magics);
magics = arrange(before,1);
console.log(magics);
不会加快求解速度。我也无法在源代码中找到对它的支持。
简短的背景故事:我正在使用 LP 解决一个整数程序,因为事实证明,宽松的解决方案可以很容易地转换为可接受的解决方案。
有支持热启动的LP求解器吗?我正在解决的问题长期处于不可行区域,我相信热启动(因为我知道一个可行的解决方案)可以大大提高运行时间。
编辑:我相信我的问题与 this question
非常相似任何帮助/提示将不胜感激。
解决方法
单纯形不使用值,它们使用基础。 所以我不确定提供提示会有所帮助。
,CLP 支持热启动 (https://www.coin-or.org/Doxygen/Clp/classCoinWarmStartBasis.html)。 你可以从 or-tools 调用它。