Skip to content

Commit 65e18b0

Browse files
committed
Fixes for mi/qps_glpk() to handle case with empty constraints.
1 parent 2500fb7 commit 65e18b0

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

lib/miqps_glpk.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,19 @@
230230
glpk_opt.msglev = verbose;
231231

232232
%% call the solver
233+
if isempty(AA)
234+
AA = sparse(1, nx);
235+
bb = 0;
236+
emptyA = true;
237+
else
238+
emptyA = false;
239+
end
233240
[x, f, errnum, extra] = ...
234241
glpk(c, AA, bb, xmin, xmax, ctype, vtype, 1, glpk_opt);
242+
if emptyA
243+
AA = sparse(0, nx);
244+
bb = [];
245+
end
235246

236247
%% set exit flag
237248
if isfield(extra, 'status') %% status found in extra.status

lib/qps_glpk.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,20 @@
197197

198198
%% call the solver
199199
t0 = tic;
200+
if isempty(AA)
201+
AA = sparse(1, nx);
202+
bb = 0;
203+
emptyA = true;
204+
else
205+
emptyA = false;
206+
end
200207
[x, f, errnum, extra] = ...
201208
glpk(c, AA, bb, xmin, xmax, ctype, vtype, 1, glpk_opt);
202209
output.runtime = toc(t0);
210+
if emptyA
211+
AA = sparse(0, nx);
212+
bb = [];
213+
end
203214

204215
%% set exit flag
205216
if isfield(extra, 'status') %% status found in extra.status

0 commit comments

Comments
 (0)