A = randn(30,15);
b = 25*rand(30,1);
c = randn(15,1);
x = binvar(15,1);
Model = A*x <= b;
sol = optimize(Model,c'*x);
while sol.problem == 0
Model = [Model, exclude(x,value(x))];
sol = optimize(Model,c'*x);
end
And all my .m file and data sheet have been uploaded (include the exclude.m in my Matlab library).
BTW, the version of my Matlab is 2017a, is there any possible that this problem has something to do with the version? Thanks a lot in advance.
Best regards,Morgan
But if I add the objective in the optimize function like this:
And I'll get the only optimal solution correctly as below:
Feasible = [];
sol = optimize(F);
while sol.problem == 0 Feasible=[Feasible [value(func);value(varx)]]; F = [F, exclude(varx,round(value(varx)))]; sol = optimize(F);endFeasible
Feasible =
48.0000 30.8900 67.9000 54.9000 54.9000 59.0000 21.9900 67.9000 30.8900 0 0 1.0000 0 0 1.0000 0 1.0000 0 0 1.0000 0 0 0 0 1.0000 0 1.0000 0 0 0 0 0 0 0 0 0 1.0000 0 0 1.0000 1.0000 0 0 0 0 0 1.0000 0 0 0 0 0 1.0000 0 0 0 0 0 0 0 0 0 0 0 0 1.0000 0 0 0 0 0 1.0000 0 0 0 1.0000 0 0 0 0 0 0 0 0 0 1.0000 0 0 0 0
ops = sdpsettings('solver','lpsolve');ops.verbose = 0;sol=optimize(F,func,ops);Feasible=[];
while sol.problem == 0 Feasible=[Feasible [value(func);value(varx)]]; F = [F, exclude(varx,round(value(varx)))]; sol = optimize(F);endFeasible