Skip to content

Commit da71d29

Browse files
committed
fix bugs with snoptmain examples
1 parent 48ad811 commit da71d29

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

matlab/examples/snmain/snoptmain2.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@
1212
%Get condensed data for the Hexagon problem.
1313
[x,xlow,xupp,xmul,xstate, ...
1414
Flow,Fupp,Fmul,Fstate, ...
15-
A.val, A.row, A.col, G.row, G.col] = hexagon;
15+
A.val, A.row, A.col, G.row, G.col, ...
16+
ObjRow, ObjAdd] = hexagon;
1617

1718
options.maximize = '';
1819

1920
[x,F,INFO] = snopt(x,xlow,xupp,xmul,xstate, ...
2021
Flow,Fupp,Fmul,Fstate, ...
2122
@snoptuserfun2, ...
23+
ObjAdd, ObjRow, ...
2224
A,G,options);
2325

2426

2527
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2628
function [x,xlow,xupp,xmul,xstate, ...
2729
Flow,Fupp,Fmul,Fstate, ...
28-
A,iAfun,jAvar,iGfun,jGvar] = hexagon()
30+
A,iAfun,jAvar,iGfun,jGvar ...
31+
Obj, ObjAdd] = hexagon()
2932
%function [x,xlow,xupp,Flow,Fupp,A,iAfun,jAvar,iGfun,jGvar] = hexagon()
3033
%
3134
% Defines the problem hexagon:
@@ -57,6 +60,7 @@
5760
neF = 19;
5861
n = 9;
5962
Obj = 1; % The default objective row
63+
ObjAdd = 0.;
6064

6165
% A dense Jacobian of F is provided in snoptuserfun2
6266

matlab/examples/snmain/snoptmain3.m

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@
1010
options.printfile = 'snoptmain3.out';
1111

1212
options.verify_level = 3;
13+
options.maximize = 1;
1314
options.derivative_option = 0;
1415

16+
1517
% Get the data defining the Hexagon problem.
1618
[x,xlow,xupp,xmul,xstate, ...
1719
Flow,Fupp,Fmul,Fstate, ...
18-
A.val,A.row,A.col,G.row,G.col] = hexagon;
20+
A.val,A.row,A.col,G.row,G.col, ...
21+
ObjRow, ObjAdd] = hexagon;
1922

2023
[x,F,INFO] = snopt(x,xlow,xupp,xmul,xstate, ...
2124
Flow,Fupp,Fmul,Fstate, ...
2225
@snoptuserfun3, ...
26+
ObjAdd, ObjRow, ...
2327
A, G, options);
2428

2529

2630
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2731
function [x,xlow,xupp,xmul,xstate, ...
2832
Flow,Fupp,Fmul,Fstate, ...
29-
A,iAfun,jAvar,iGfun,jGvar] = hexagon()
33+
A,iAfun,jAvar,iGfun,jGvar, ...
34+
Obj, ObjAdd] = hexagon()
3035
%function [x,xlow,xupp,Flow,Fupp,A,iAfun,jAvar,iGfun,jGvar] = hexagon()
3136
%
3237
% Defines the problem hexagon:
@@ -58,6 +63,7 @@
5863
neF = 19;
5964
n = 9;
6065
Obj = 1; % The default objective row
66+
ObjAdd = 0.;
6167

6268
% The nonzeros of the Jacobian of F are provided in snoptuserfun3
6369

@@ -164,6 +170,4 @@
164170
.2;
165171
.25;
166172
-.2;
167-
-.25 ];
168-
169-
snset('Maximize');
173+
-.25 ];

0 commit comments

Comments
 (0)