Skip to content

Commit e25efe1

Browse files
author
David P. Chassin
committed
Update cvx_utils.py
1 parent bff43d0 commit e25efe1

File tree

4 files changed

+381
-1090
lines changed

4 files changed

+381
-1090
lines changed

module/optimize/autotest/cvx_utils.py

Lines changed: 0 additions & 181 deletions
This file was deleted.

module/optimize/autotest/test_cvx.glm

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,12 @@ x = Variable(n)
157157
object cvx
158158
{
159159
name "problem-x";
160-
event PRECOMMIT;
161-
presolve "G = utils.Network(); print(G.W.todense(),G.L.todense(),file=sys.stderr)";
162-
//presolve "print(gld.objects,gld.globals,gld.classes,gld.property('problem-y','value'),gld.property('clock'),file=sys.stderr)";
163-
//presolve "m=20; n=15; np.random.seed(1); A=np.random.rand(m,n); b=np.random.rand(m); x=Variable(n)";
160+
event INIT;
164161
variables "x=test:x";
165-
// variables "y=test:y&lambda";
166162
data "A=test:A0"; // ,test.A1,test.A2,test.A3;b1=test.b1;b2=test.b2";
167-
//presolve "print(A,file=sys.stderr)";
168-
// variables "y=test:y"; // duplicate test
169-
// variables "p=pypower.bus:Pd,q=bus.Qd"; // class and module.class tests
170-
// variables "p=test_group@x"; // group test
171-
// variables "x=test.x&mu"; // duplicate error
172-
// variables "y=test.y"; // duplicate error
173-
// variables "z=test.z"; // not found error
163+
presolve "G = utils.Network(); np.set_printoptions(6); print(f'G_W =\\n{G.W.todense()}\\nG_L =\\n{G.L.todense()}\\nA = {np.array(A)}',file=sys.stderr)";
174164
objective "Minimize(sum_squares(A@x))";
175165
constraints "x >= 1";
176-
// constraints "x<=-1";
177-
// constraints "x<=1,y==2*x";
178-
// constraints "x>=2"; // makes the problem infeasible (for testing purposes)
179-
// postsolve "import sys;print(f'Optimal value is {__value__:.2f}',file=sys.stderr)";
180-
// postsolve "import sys; print('\\n'.join([f'{x}: {str(y)}' for x,y in __problem__.get_problem_data(__problem__.solver_stats.solver_name)[0].items()]),file=sys.stderr)";
181166
}
182167

183168
object cvx

0 commit comments

Comments
 (0)