From fe4d0df8055a66b0ff16d072523828a7acca8fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20L=C3=B6fberg?= Date: Wed, 21 Jun 2023 18:21:17 +0200 Subject: [PATCH] Sanity check objective dimensions in solvebilevel --- modules/bilevel/solvebilevel.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/bilevel/solvebilevel.m b/modules/bilevel/solvebilevel.m index 3446ddc4..1ace1294 100644 --- a/modules/bilevel/solvebilevel.m +++ b/modules/bilevel/solvebilevel.m @@ -57,6 +57,10 @@ end end +if numel(OuterObjective) > 1 || numel(InnerObjective) > 1 + error('The objective functions have to be scalar functions'); +end + % User wants to use fmincon, cplex or something like if strcmp(options.bilevel.algorithm,'external') % Derive KKT conditions of inner problem, append with outer, and solve