小编Ron*_*Ron的帖子

Apache常见的SimplexSolver ObjectiveFunction,用于最大化矩阵中值的总和

我试图通过使用apache-commons的Simplex解算器解决以下线性问题:org.apache.commons.math3.optim.linear.SimplexSolver.

http://mathurl.com/ovh582z

n
m数是列数
L是每行总和的全局限制

这是我到目前为止:

List<LinearConstraint> constraints = new ArrayList<>();

double[][] A = calculateAValues();
// m = count of columns
// constraint 1: the sum of values in all column must be <= 1
for(int i = 0; i < m; i++) {
    double[] v = new double[n];
    for(int j=0; j < n; j++) {
        v[j] = 1;
    }
    constraints.add(new LinearConstraint(v, Relationship.LEQ, 1));
}
// n = count of rows
// constraint 2: sum of …
Run Code Online (Sandbox Code Playgroud)

java linear-programming apache-commons apache-commons-math

8
推荐指数
1
解决办法
766
查看次数