solve function is not working in R2022a Update 5

Hi :)
After updating to R2022a Update 5 version of MATLAB, the "solve" function is not working as it did before.
Diagnozing the problem should start with getting the minimal working example, so I "copy-pasted" the short code from MATLAB Documentation on function "solve" (see below). Unexpectedly, running this code resulted in exactly the same error message, as the one I get while running my own program.
I would appreciate your comments and hints on this case.
Thank you,
Grzegorz
Here is the code "copy-pasted" from MATLAB Documentation:
x = optimvar('x');
y = optimvar('y');
prob = optimproblem;
prob.Objective = -x - y/3;
prob.Constraints.cons1 = x + y <= 2;
prob.Constraints.cons2 = x + y/4 <= 1;
prob.Constraints.cons3 = x - y <= 2;
prob.Constraints.cons4 = x/4 + y >= -1;
prob.Constraints.cons5 = x + y >= 1;
prob.Constraints.cons6 = -x + y <= 2;
sol = solve(prob)
Here is the error message:
Solving problem using linprog.
ERROR - (linprog): problem must contain at least "f", "A" and "b".
Error using optim.problemdef.OptimizationProblem/solve
Output argument "x" (and possibly others) not assigned a value in the execution with "linprog" function.

7 commentaires

Work for me
>> x = optimvar('x');
y = optimvar('y');
prob = optimproblem;
prob.Objective = -x - y/3;
prob.Constraints.cons1 = x + y <= 2;
prob.Constraints.cons2 = x + y/4 <= 1;
prob.Constraints.cons3 = x - y <= 2;
prob.Constraints.cons4 = x/4 + y >= -1;
prob.Constraints.cons5 = x + y >= 1;
prob.Constraints.cons6 = -x + y <= 2;
sol = solve(prob)
Solving problem using linprog.
Optimal solution found.
sol =
struct with fields:
x: 0.6667
y: 1.3333
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.12.0.2039608 (R2022a) Update 5
Thank you, Bruno.
My guess is that the third-party software, which I am using with MATLAB, overloads the original solve command.
Anyway, thanks for your comment.
Best,
Grzegorz
Hello? Has the problem been solved?
Matt J
Matt J le 2 Mar 2024
@SamVector Yes, the problem has been solved.
SamVector
SamVector le 2 Mar 2024
Modifié(e) : SamVector le 2 Mar 2024
Excuse me, but I faced the same problem lately, and I want to know how exactly did you do to solve the problem? Which third party software is likely to cause the trouble? Thanks in advance🙏
Thanks. Although I have no idea how the problem has been solved, The problem vanished after I reinstall the Optimization toolbox. I think it may be conflit with the matpower toolbox I installed.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Linear Programming and Mixed-Integer Linear Programming dans Centre d'aide et File Exchange

Produits

Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by