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.
  1 件のコメント
Aakash Rajwani
Aakash Rajwani 2015 年 10 月 22 日
Thanks for directing me towards using ga(). It seems that you know about ga. Can you please do me a favor (again) and tell me something about this error that I am getting on using ga-
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver 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