Add optimization constraint using the maximum value of decision variables
Show older comments
Hi, I need to add the following optimization constraint:

Where D_ij is a constant matrix and X_ij is a decision variable matrix.
I tried using:
max(D.*X,[],1)
but its output was :
Error using max
Invalid data type. First argument must be numeric or logical.
Does anyone know how to include it, please?
Thank you.
4 Comments
Matt J
on 31 Dec 2019
More context is needed. What code was used to generate X and D?
Julio Cesar Franco Ardila
on 31 Dec 2019
Walter Roberson
on 31 Dec 2019
I see you define an optimization variable R, and I see that you appear to be wanting to constrain R, but I do not see you use R anywhere?
Julio Cesar Franco Ardila
on 31 Dec 2019
Accepted Answer
More Answers (1)
Walter Roberson
on 31 Dec 2019
Edited: Walter Roberson
on 31 Dec 2019
0 votes
max() is not a supported operation on optimization variables or in forming optimization constraints.
In order to implement what you want, you will need to use solver based optimization and non-linear equality constraints (and possibly non-linear inequality constraints for other variables.)
1 Comment
Matt J
on 31 Dec 2019
And you will need to use a differentiable approximation to the max() operator, e.g., the softmax function
That's assuming you pursue a solution with fmincon. Global Optimization toolbox solvers like ga() and patternsearch() don't care.
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!