# Optimization of a matrix with integers with nonlinear objective functions and nonlinear constraints

5 views (last 30 days)
b999 on 9 Sep 2023
Edited: John D'Errico on 9 Sep 2023
Hello all,
I have the following problem:
I want to optimize a matrix, which contains integer entries (e.g. A = [ 1 2 3 ; 2 1 1]), that the integers are arranged in the matrix. Each integer represents one area. I have linear and non-linear objective functions and boundary conditions.
My question now would be which algorithm would be useful. Intlinprog does not work in my opinion, because there are no non-linear objective functions or boundary conditions possible and fmincon does not work because you can not calculate any integer as x0. Do you have an idea which algorithm I can use in Matlab?
Thank you very much.
##### 2 CommentsShow 1 older commentHide 1 older comment
b999 on 9 Sep 2023
As a result I would like to get a matrix at the end, which contains as entries Integers. So for example the matrix A = [ 1 2 3 ; 2 1 1] shall be optimized to A = [ 2 2 1 ; 2 1 2]. And according to my research it is not possible with fmincon to get integers as final output. I understood it in such a way that fmincon would then output for example A = [ 2.1213 2.234526 1.151266 ; 2.165256 1.1416783 2.1515414]. However, I need A = [ 2 2 1 ; 2 1 2].

John D'Errico on 9 Sep 2023
Edited: John D'Errico on 9 Sep 2023
You are correct, in that fmincon does not provide integer constraints as an option, and that a tool like intlinprog does not allow nonlinear constraints.
This class of problem will typically fall into the domain of tools from the Global Optimization toolbox, mainly GA. (I cannot recall if any other of those tools allow integer constraints. I checked once, and there were no other options at that time, except for GA.) GA can accept integer constraints on the variables, but also nonlinear constraints on them.
Walter Roberson on 9 Sep 2023
ga accepts an options structure that supports an 'InitialPopulationMatrix' -- so it can take starting values (just not conveniently)
The nonlinear equality A == B can be coded as the pair of nonlinear inequalities [A - B, B - A] which corresponds to A <= B & B <= A which is only true for A == B . You can do this -- but it will probably still have a lot of trouble finding matching points.

### Categories

Find more on Surrogate Optimization in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!