【发布时间】:2016-01-11 08:59:32
【问题描述】:
我想求解一个具有离散值的非线性多变量方程,如下所示:
x*y + z + t - 10 = 0
有约束:
10 < x < 100
等等。
我正在尝试使用 Choco 库来做这件事,但我有点迷茫。 我找到了这段代码:
// 1. Create a 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.lexico_LB(x, y));
// 5. Launch the resolution process
solver.findSolution();
//6. Print search statistics
Chatterbox.printStatistics(solver);
但我不明白我将方程式放在哪里。
【问题讨论】:
标签: java equation-solving choco