File Exchange

image thumbnail

fminconset

version 1.0.0.0 (11.7 KB) by Ingar Solberg
Solves constrained minimization problems, some of the variables are restricted to discrete values

5 Downloads

Updated 14 Jan 2000

No License

fminconset: Solves constrained minimization problems where some
of the variables are restricted to discrete values. (Mixed Integer
Nonlinear optimization). Based on fmincon from Optimization Toolbox
version 2.0.

Comments and Ratings (6)

Lenilein

I looking in the code and I believe following line provides explanation to my question:
if ~any(abs(x(i) - set{i}) < optimget(options,'TolX'))

=> by setting TolX, you set the maximum possible interval between the value of your set (like [0 1] for a binary variable) and the calculated value for the variable.
Therefore, unless you set TolX to 0, I guess you could always get some non-integer values for your variable.

Lenilein

Thanks Ingar for posting this piece!

However I have got some unconsistency in the results provided by the function for my problem:
It seems to work well in first approach (exitflat=2) and I get a "good" comment in the command window: Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.

But when I look at the values for my variable, I see that I obtained non-integer values!!

I set:
set={[0 1],[0 1]};
x0=[0 0]'; xlb=[0 0]'; xub=[1 1]';
options=optimset('Hessian','off','largescale','off','Gradobj','off','Gradconstr','off','TolX',1e-6,'display','iter','tolcon',1e-6,'Derivativecheck','on','FinDiffRelStep',1e-10);

[x,h,exitflag,output,lambda,grad,hessian] = fminconset(fun,x0,[],[],[],[],xlb,xub,'nonlcon',options,set,Inf);

Do you have any idea what could be going wrong in the script? (I know it has been a while that you posted it!!)
I ran your example and it works well...

you could compare it with translation of the routine to Python, see http://openopt.org/MINLP for details.

dinesh birla

I have not been able to download so far then send comments

moussa almou

matlab code for the diet problem

Girija Chetty

MATLAB Release Compatibility
Created with R11
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired: MINLP: Mixed Integer Nonlinear Programming