Commit 813bfcce by dongshufeng

refactor: make tetest pass

parent 7690a760
input = read_url("https://shufengdong.github.io/sparrowzz/tetests/input2.csv");
input = read_tensor_url(`https://shufengdong.github.io/sparrowzz/tetests/input2.csv`);
a = [[0.0, 0.], [0, 0.0]];
b = 1;
while 1 {
......
f = min(x1 * x4 * (x1 + x2 + x3) + x3);
g1 = x1 * x2 * x3 * x4;
g2 = x1^2 + x2^2 + x3^2 + x4^2;
f = `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]);
r1 = fmincon(min(`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],
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]);
[1,1,1,1],[5,5,5,5],[`x1`,x2,x3,x4]);
println(r1);
println(r2);
return r2;
\ No newline at end of file
re_4_4
mat_4_4
0.2393
0.0493
0.0493
......
// 目标函数
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]);
f = (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(max(`f`), [`g`], [1,1,1,1,1], [x1,`x2`,`x3`,`x4`,`x5`]);
return r;
\ No newline at end of file
g1 = x1+3/3 * x2+ min(2,5)*x3 - 1;
g2 = 1*3*x2 - 4*3;
g3 = 1*3 * x2+sin(8-2)*x3 - 7;
g1 = `x1`+3/3 * x2+ min(2,5)*x3 - 1;
g2 = 1*3*`x2` - 4*3;
g3 = 1*3 * `x2`+sin(8-2)*x3 - 7;
b = [0,0,0];
r = sp_linsolve([g1,g2,g3], b, [0,0,0], [x1,x2,x3]);
r2 = sp_linsolve([g1,g2,g3], [], [], [x1,x2,x3]);
r = sp_linsolve([`g1`,`g2`,g3], b, [0,0,0], [`x1`,x2,x3]);
r2 = sp_linsolve([`g1`,g2,g3], [], [], [`x1`,x2,x3]);
return r-r2;
\ No newline at end of file
// define the indices
BUS_I = 1; // bus number (1 to 29997)
BUS_TYPE = 2; // bus type (1 - PQ bus, 2 - PV bus, 3 - reference bus, 4 - isolated bus)
PD = 3; // Pd, real power demand (MW)
QD = 4; // Qd, reactive power demand (MVAr)
GS = 5; // Gs, shunt conductance (MW at V = 1.0 p.u.)
BS = 6; // Bs, shunt susceptance (MVAr at V = 1.0 p.u.)
BUS_AREA = 7; // area number, 1-100
VM = 8; // Vm, voltage magnitude (p.u.)
VA = 9; // Va, voltage angle (degrees)
BASE_KV = 10; // baseKV, base voltage (kV)
ZONE = 11; // zone, loss zone (1-999)
VMAX = 12; // maxVm, maximum voltage magnitude (p.u.) (not in PTI format)
VMIN = 13; // minVm, minimum voltage magnitude (p.u.) (not in PTI format)
// included in opf solution, not necessarily in input
// assume objective function has units, u
LAM_P = 14; // Lagrange multiplier on real power mismatch (u/MW)
LAM_Q = 15; // Lagrange multiplier on reactive power mismatch (u/MVAr)
MU_VMAX = 16; // Kuhn-Tucker multiplier on upper voltage limit (u/p.u.)
MU_VMIN = 17; // Kuhn-Tucker multiplier on lower voltage limit (u/p.u.)
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论