quadprog constraint problem - x equal one value or another

2 views (last 30 days)
Hey,
I am trying to use quadprog to calculate the minimum of a function with some basic constraints.
- I need the values of x to sum to specific total (e.g. 36)
- I need the values of x which are being minimized to equal either 0 or 6
I am running into trouble with the last constraint and was wondering if there was any way to use a logical operator or just define the variables to only be allowed to equal one value or another.
Thanks in advance for any help

Accepted Answer

Alan Weiss
Alan Weiss on 26 Jul 2013
There are exactly two solvers at present that can address discrete problems:
  • bintprog, which has only linear objective function
  • ga from Global Optimization Toolbox, which can handle arbitrary integer variables and objective functions, but does not allow equality constraints
So your case falls outside both of these solvers.
If all your variables are discrete, you could probably just run through all possible values, assuming you have no more than 20 or so components in x. Otherwise I am afraid that you are going to have to come up with your own solver.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Categories

Find more on Problem-Based Optimization Setup 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!