我正在尝试将 Excel Solver 解决方案转换为 Java 应用程序
excel求解器是
Solver Parameters:
Set Objective: D24 to Max
By Changing Variable Cells: C4:C23
Subject to the Constraints:
C24 = B24
L24 <= N24
L25 >= N25
(non-negative)
GRG Nonlinear
我已经有一段时间了,找不到一个 java 库来实现这一点。有任何想法吗?
我试过 choco-solver http://www.emn.fr/z-info/choco-solver/
Solver solver = new Solver("my first problem");
// 2. Create variables through the variable factory
IntVar x = VariableFactory.bounded("X", 0, 5, solver);
IntVar y = VariableFactory.bounded("Y", 0, 5, solver);
// 3. Create and post constraints by using constraint factories
solver.post(IntConstraintFactory.arithm(x, "+", y, "<", 5));
// 4. Define the search strategy
solver.set(IntStrategyFactory.inputOrder_InDomainMin(new IntVar[]{x,y} ));
// 5. Launch the resolution process
if (solver.findSolution()) {
do {
prettyOut();
}
while (solver.nextSolution());
}
我发现很难将它与 Excel 求解器函数联系起来,我的数学不是很好