but in cplex optimizer

Something really weird is going on in the cplex optimizer.
When I run
Trial>> w2 = cplexmilp(-f,D,b2,[],[],[],[],[],[],[],ctype);
Trial>> f2'*w2
ans =
0.4998
Trial>> w2 = cplexmilp(-f2,D,b2,[],[],[],[],[],[],[],ctype);
Trial>> f2'*w2
ans =
9.1000e-04
When I use a different objective function f it gives me a better solution for f2.

1 Comment

Did you check cplexmilp's exitflag in both cases ?
Best wishes
Torsten.

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 18 Oct 2015

0 votes

It looks like you're comparing apples and oranges. In your first call, your first input is f but you're computing f2'*w2. In your second call, you're using f2 both as the input and in the computation of the quantity you're using for comparison.

1 Comment

My point is that somehow minimizing -f*w2 gives a lower value of -f2*w2 than minimizing -f2*w2 directly this is clearly a bug in cplex.

Sign in to comment.

Walter Roberson
Walter Roberson on 19 Oct 2015

0 votes

Mathworks has no built-in CPLEX .
Bugs (if they are bugs) in CPLEX are not under the control of Mathworks.
However, I have no reason to believe the output is an error. Consider that provided all constraints where met, I could pass copies of -inf in as the objective function; the output could well be -inf and the multiplication of that with w2 would produce -inf, a smaller value than what you got so far. If you put in different column vectors then you get different outputs, and that is to be expected.

5 Comments

No the problem is that the w2 generated from cplexmilp(-f,D,b2,[],[],[],[],[],[],[],ctype); is a better solution for min -f2*w2 than the one outputed by cplexmilp(-f2,D,b2,[],[],[],[],[],[],[],ctype); there is no -inf everything here is finite.
-inf is an extreme example of why there is no reason to expect that when you change column vectors -f and -f2 that there might not be a much different result of the multiplication.
Perhaps you are trying to do something akin to minimizing the result of a multiplication with a positive definite matrix expressed through your constraints, but at present we have no reason to expect that to be even a possible use of cplexmilp.
One thing we do not know is whether the w2 created with -f satisfies the constraints of the system when using -f2
This is an integer programming problem. I do not understand I am using the same constraints in both.
cplexmilp is, I would remind you, a function that is not provided by Mathworks and is not part of the File Exchange. We do not even know what the parameters mean unless you describe them.
For example it would be entirely possible (and common!) in constrained optimization for there to be a linear constraint that did not treat the elements of the vector equally, such that for the w2 produced for -f2 does not match the same boundaries implied by -f . For example f and f2 might have 0s in different places, and those values might be multiplied by vector components towards a constrained sum; with the 0s being present, a result that is valid or meaningful for -f might not be valid for -f2 because the 0s implied that different components should be ignored.
Torsten
Torsten on 20 Oct 2015
Edited: Torsten on 20 Oct 2015
I must admit I don't understand your reasoning.
The call
w2 = cplexmilp(-f2,D,b2,[],[],[],[],[],[],[],ctype);
should give a vector w2 such that
f2'*w <= f2'*w2
for all feasable vectors w.
But
w1 = cplexmilp(-f,D,b2,[],[],[],[],[],[],[],ctype);
with a different objective function f (which does not matter in this case), but with the same constraints, gives a vector w1 with
f2'*w1 > f2'*w2
which should not be possible.
As already mentionned, I suggest that the OP checks the exitflags of cplexmilp in both cases.
Or maybe there are local maxima because of integer programming.
Best wishes
Torsten.

Sign in to comment.

Categories

Asked:

on 18 Oct 2015

Edited:

on 20 Oct 2015

Community Treasure Hunt

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

Start Hunting!