Commit 3c4d9e01 by dongshufeng

增加测试文件

parent d1e7ca76
input = read_tensor("./input2.csv");
a = [[0.0, 0.], [0, 0.0]];
b = 1;
while 1 {
if b > 10 {
break;
}
a = a + [[1.0, 0.], [0, 1.0]];
b = b + 1;
}
println(input);
return a;
f = min(x1 * x4 * (x1 + x2 + x3) + x3);
g1 = x1 * x2 * x3 * x4;
g2 = x1^2 + x2^2 + x3^2 + x4^2;
x_lower = [1, 1, 1, 1];
x_upper = [5, 5, 5, 5];
r1 = fmincon(f, [g1, g2], [25, 40], [2e19, 40], x_lower,x_upper,[x1,x2,x3,x4]);
r2 = fmincon(min(x1 * x4 * (x1 + x2 + x3) + x3),
[x1 * x2 * x3 * x4, x1^2 + x2^2 + x3^2 + x4^2],
[25, 40], [2e19, 40],
[1,1,1,1],[5,5,5,5],[x1,x2,x3,x4]);
println(r1);
println(r2);
\ No newline at end of file
re_4_4
0.2393
0.0493
0.0493
0.0493
0.0493
0.2393
0.0493
0.0493
0.0493
0.0493
0.2393
0.0493
0.0493
0.0493
0.0493
0.4173
// 目标函数
f = max((5*1)*x1+3*x2+2*x3+(10-3)*x4+4*x5);
g = [2*x1 + (2*4)*x2 + 4*x3 + 2*x4 + max(1,5)*x5 <= 5*2];
r = intlinprog(f, g, [1,1,1,1,1], [x1,x2,x3,x4,x5]);
return r;
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论