Is there a way to set binary constraints on a variable? (Like the 'bin' constraint in the Excel Solver)

1 次查看(过去 30 天)
I am using FMINCON and I have a set of decision variables which have to be binary. I am looking for something EXACTLY like the 'bin' constraint that the Excel Solver has.
I have set lower bounds (lb) of 0 and upper bounds (ub) of 1 on these. Now I know that I can simply use logical() for converting them into binary for use in the function but that's not the problem. The problem is that there are close to 100 of these variables and it seems like the solver can guess any decimal values between 0 and 1 which will be highly(highly!) inefficient and take a lot of computing time.
I want to force MATLAB to keep it's guesses fixed to either 0 and 1.
I read about a way I can force that- Defining these variables to be of integer type and hence, the ub and lb will make sure it's left with only two choices (0 and 1).
So even if you know how I can define these as integers (and not binary), it will be perfect for me.
I am eagerly looking forward to your answers :)

采纳的回答

Matt J
Matt J 2015-10-22
fmincon does not support integer constraints, but intlinprog() and ga() do.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by