Can i convert a binary matrix to a function?

2 views (last 30 days)
Maria on 27 Sep 2022
Commented: Maria on 7 Oct 2022
Hello everyone!
i have a binary matrix R(m*n), each row has multiple "1" , i want to optimize it in order to get only "1" in each row and no more than 3 "1" in each column. i want to user an optmizer but all of them need an optmization function. so can i return the matrix to a function in order to solve this problem?
thanks in advance
Maria on 7 Oct 2022
@Torsten okay! i got it , thank you very much for you help.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 27 Sep 2022
Yes, you can return a matrix from the function. However, that would be considered multiple objectives, and you would need to use one of the multi-objective optimizers.
To use optimizers such as fmincon() or ga() your objective function needs to return a scalar (well, except as determined by any UseVectorized option that might be in effect.)
... which I already told you in your earlier question.

Community Treasure Hunt

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

Start Hunting!