在 ojAlgo 中显示所有可能的解决方案
Display all possible solutions in ojAlgo
问题:是否可以调整以上内容以产生所有可能的结果而不是优化的结果。
详情:给定一组装甲数据,我想生成一组满足我的约束的组合。
Variable helm1 = model.addVariable("Helm 1").binary();
Variable helm2 = model.addVariable("Helm 2").binary();
Variable helm3 = model.addVariable("Helm 3").binary();
Variable arm1 = model.addVariable("Arm 1").binary();
Variable arm2 = model.addVariable("Arm 2").binary();
Variable arm3 = model.addVariable("Arm 3").binary();
Expression statA = model.addExpression().lower(0).weight(1);
Expression statB = model.addExpression().lower(0).weight(1);
Expression statC = model.addExpression().lower(0).weight(1);
//Lower Limit set for desired stat
Expression statD = model.addExpression().lower(2).weight(1);
// Limit number of helms you can equip
model.addExpression().upper(1).set(helm1,1).set(helm2,1).set(helm3,1);
model.addExpression().upper(1).set(arm1,1).set(arm2,1).set(arm3,1);
statA.set(arm1, 1);
statB.set(helm2, 1);
statB.set(helm3, 1);
statB.set(arm2, 1);
statC.set(helm1, 1);
statC.set(arm2, 1);
statC.set(arm3, 1);
statD.set(helm3, 3);
statD.set(arm1, 1);
Optimisation.Result result = model.maximise();
BasicLogger.debug(result);
注意:在推荐库之前,请注意库必须兼容Android。
答案:否 - ojAlgo 将输出 1(如果能找到它的最优解)。
问题:是否可以调整以上内容以产生所有可能的结果而不是优化的结果。
详情:给定一组装甲数据,我想生成一组满足我的约束的组合。
Variable helm1 = model.addVariable("Helm 1").binary();
Variable helm2 = model.addVariable("Helm 2").binary();
Variable helm3 = model.addVariable("Helm 3").binary();
Variable arm1 = model.addVariable("Arm 1").binary();
Variable arm2 = model.addVariable("Arm 2").binary();
Variable arm3 = model.addVariable("Arm 3").binary();
Expression statA = model.addExpression().lower(0).weight(1);
Expression statB = model.addExpression().lower(0).weight(1);
Expression statC = model.addExpression().lower(0).weight(1);
//Lower Limit set for desired stat
Expression statD = model.addExpression().lower(2).weight(1);
// Limit number of helms you can equip
model.addExpression().upper(1).set(helm1,1).set(helm2,1).set(helm3,1);
model.addExpression().upper(1).set(arm1,1).set(arm2,1).set(arm3,1);
statA.set(arm1, 1);
statB.set(helm2, 1);
statB.set(helm3, 1);
statB.set(arm2, 1);
statC.set(helm1, 1);
statC.set(arm2, 1);
statC.set(arm3, 1);
statD.set(helm3, 3);
statD.set(arm1, 1);
Optimisation.Result result = model.maximise();
BasicLogger.debug(result);
注意:在推荐库之前,请注意库必须兼容Android。
答案:否 - ojAlgo 将输出 1(如果能找到它的最优解)。