将Excel解算器转换为java

时间:2013-07-30 08:31:17

标签: java excel

我正在尝试将Excel解算器解决方案转换为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求解器函数联系起来,我的数学不是很好

2 个答案:

答案 0 :(得分:0)

如果您正在寻找用于读取和写入Microsoft文档的API,请查看Apache POI:

http://poi.apache.org/
http://viralpatel.net/blogs/java-read-write-excel-file-apache-poi/

答案 1 :(得分:0)

Simplexsolver implementation in Apache Commons Math,但我无法就性能或可能的问题规模发表任何言论。寻找优化问题的非有效解决方案可能很棘手,因为很难有效地优化大问题规模,而且这是一个持续的研究领域,只有充足的商业/研究解决方案。

如果您想将excelfiles保留为输入,则需要解析数据并进行转换。要阅读Excel文件,您可以使用Apache POI

相关问题