I have found the problem, but it is too strange for me. I simplified my model as much as possible, and fabricated a small example to reflect its core issue, although this example may seem strange. We might as well call this example a Pen Selecting Problem (PSP). I hope my question can be solved with your help.
- Pen Selecting Problem 1 (PSP-1). There are three brands (A, B, and C) of pens in the store, each with four different color styles: black cap & black body, black cap & white body, white cap & black body, and white cap & white body. We know that pens of different color styles in diferent brands are sold at different prices. Now we want to purchase a pen from each of the three brands at minimal total cost. How shall we select?
The model I build for PSP-1 is given as follow. This is an MILP and can be solved correctly.
$title Pen Selecting Problem 1 (PSP-1)
$ontext
There are three brands (A, B, and C) of pens in the store, each with four different color styles:
black cap & black body, black cap & white body, white cap & black body, and white cap & white body.
We know that pens of different color styles in diferent brands are sold at different prices.
Now we want to buy a pen from each of the three brands at minimal total cost.
How shall we select?
$offtext
Sets
Brand /A, B, C/
CapColor /black, white/
;
alias(CapColor, BodyColor);
Table Price(Brand, CapColor, BodyColor)
black white
A.black 1 2
A.white 4 3
B.black 8 2
B.white 6 4
C.black 9 12
C.white 6 3
;
Binary Variables
x(Brand, CapColor, BodyColor)
;
Variables
Cost
;
Equations
Constraint(Brand)
ObjFunc
;
Constraint(Brand)..
sum(CapColor, sum(BodyColor, x(Brand, CapColor, BodyColor))) =e= 1;
ObjFunc..
Cost =e= sum(Brand, sum(CapColor, sum(BodyColor, Price(Brand, CapColor, BodyColor) * x(Brand, CapColor, BodyColor))));
Model myPenSelecting /all/;
Solve myPenSelecting using MINLP minimizing Cost;
Now we add an new rule to let PSP-1 become an MINLP.
- Pen Selecting Problem 2 (PSP-2). Now we add a new rule: If a mixed color pen (black cap & white body or white cap & black body) is selected from brand A, then a mixed color pen with the same style as the one from brand A (i.e. same cap color and same body color) OR a single color (black cap & black body or white cap & white body) pen whose color is same as the body color of the pen from brand A must be select from brand B, and so on, for brand B and C.
Its GAMS model is
$title Pen Selecting Problem 2 (PSP-2)
$ontext
There are three brands (A, B, and C) of pens in the store, each with four different color styles:
black cap & black body, black cap & white body, white cap & black body, and white cap & white body.
We know that pens of different color styles in diferent brands are sold at different prices.
Now we want to buy a pen from each of the three brands at minimal total cost.
How shall we select?
Now we add a new rule: If a mixed color pen (black cap & white body or white cap & black body) is
selected from brand A, then a mixed color pen with the same style as the one from brand A (i.e. same
cap color and same body color) OR a single color (black cap & black body or white cap & white body)
pen whose color is same as the body color of the pen from brand A must be select from brand B, and
so on, for brand B and C.
$offtext
Sets
Brand /A, B, C/
CapColor /black, white/
;
alias(CapColor, BodyColor);
Table Price(Brand, CapColor, BodyColor)
black white
A.black 1 2
A.white 4 3
B.black 8 2
B.white 6 4
C.black 9 12
C.white 6 3
;
Binary Variables
x(Brand, CapColor, BodyColor)
;
Variables
Cost
;
Equations
Constraint_1(Brand)
Constraint_2(Brand, CapColor, BodyColor)
ObjFunc
;
Constraint_1(Brand)..
sum(CapColor, sum(BodyColor, x(Brand, CapColor, BodyColor))) =e= 1;
Constraint_2(Brand, CapColor, BodyColor)$(ord(Brand) > 1)..
(1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor) * (x(Brand, CapColor, BodyColor) + x(Brand, BodyColor, BodyColor))
=e= (1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor);
ObjFunc..
Cost =e= sum(Brand, sum(CapColor, sum(BodyColor, Price(Brand, CapColor, BodyColor) * x(Brand, CapColor, BodyColor))));
Model myPenSelecting /all/;
myPenSelecting.OptCR = 0;
*OPTION MINLP = BARON;
x.l(Brand, 'black', 'black') = 1;
Solve myPenSelecting using MINLP minimizing Cost;
and it can be solved by DICOPT with status 2 Locally Optimal and by BARON with 1 Optimal.
Then, we further enrich this model.
- Pen Selecting Problem 3 (PSP-3). Furthermore, we consider the user experience indices of the pens we selected. Assume that the user experience index of each pen is only related to its color style, which is described by table ExpIndex(CapColor, BodyColor) in GAMS.
So here we additionally declare variables Experience(Brand) and equations Constraint_3(Brand) in the code.
$title Pen Selecting Problem 3 (PSP-3)
$ontext
There are three brands (A, B, and C) of pens in the store, each with four different color styles:
black cap & black body, black cap & white body, white cap & black body, and white cap & white body.
We know that pens of different color styles in diferent brands are sold at different prices.
Now we want to buy a pen from each of the three brands at minimal total cost.
How shall we select?
Now we add a new rule: If a mixed color pen (black cap & white body or white cap & black body) is
selected from brand A, then a mixed color pen with the same style as the one from brand A (i.e. same
cap color and same body color) OR a single color (black cap & black body or white cap & white body)
pen whose color is same as the body color of the pen from brand A must be select from brand B, and
so on, for brand B and C.
Furthermore, we consider the user experience indices of the pens we selected. Assume that the user
experience index of each pen is only related to its color style, which is described by table
ExpIndex(CapColor, BodyColor). So here we additionally declare variables Experience(Brand) and equations
Constraint_3(Brand).
$offtext
Sets
Brand /A, B, C/
CapColor /black, white/
;
alias(CapColor, BodyColor);
Table Price(Brand, CapColor, BodyColor)
black white
A.black 1 2
A.white 4 3
B.black 8 2
B.white 6 4
C.black 9 12
C.white 6 3
;
Table ExpIndex(CapColor, BodyColor)
black white
black 0.5 0.3
white 0.9 0.7
;
Binary Variables
x(Brand, CapColor, BodyColor)
;
Variables
Cost
Experience(Brand)
;
Equations
Constraint_1(Brand)
Constraint_2(Brand, CapColor, BodyColor)
Constraint_3(Brand)
ObjFunc
;
Constraint_1(Brand)..
sum(CapColor, sum(BodyColor, x(Brand, CapColor, BodyColor))) =e= 1;
Constraint_2(Brand, CapColor, BodyColor)$(ord(Brand) > 1)..
(1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor) * (x(Brand, CapColor, BodyColor) + x(Brand, BodyColor, BodyColor))
=e= (1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor);
Constraint_3(Brand)..
Experience(Brand) =e= sum(CapColor, sum(BodyColor, ExpIndex(CapColor, BodyColor) * x(Brand, CapColor, BodyColor)));
ObjFunc..
Cost =e= sum(Brand, sum(CapColor, sum(BodyColor, Price(Brand, CapColor, BodyColor) * x(Brand, CapColor, BodyColor))));
Model myPenSelecting /all/;
myPenSelecting.OptCR = 0;
*OPTION MINLP = BARON;
x.l(Brand, 'black', 'black') = 1;
Solve myPenSelecting using MINLP minimizing Cost;
This model can also be normally solved: DICOPT gives status 2 Locally Optimal and BARON gives 1 Optimal.
However, when we consider a special case of the above model, problem arises.
- Pen Selecting Problem 4 (PSP-4). Now let’s consider a special case of PSP-3 where there are three brands (A, B, and C) of pens in the store, but each with only one color style: black cap & black body.
So the GAMS model of PSP-3 is modified as follow.
$title Pen Selecting Problem 4 (PSP-4)
$ontext
There are three brands (A, B, and C) of pens in the store, each with four different color styles:
black cap & black body, black cap & white body, white cap & black body, and white cap & white body.
We know that pens of different color styles in diferent brands are sold at different prices.
Now we want to buy a pen from each of the three brands at minimal total cost.
How shall we select?
Now we add a new rule: If a mixed color pen (black cap & white body or white cap & black body) is
selected from brand A, then a mixed color pen with the same style as the one from brand A (i.e. same
cap color and same body color) OR a single color (black cap & black body or white cap & white body)
pen whose color is same as the body color of the pen from brand A must be select from brand B, and
so on, for brand B and C.
Furthermore, we consider the user experience indices of the pens we selected. Assume that the user
experience index of each pen is only related to its color style, which is described by table
ExpIndex(CapColor, BodyColor). So here we additionally declare variables Experience(Brand) and equations
Constraint_3(Brand).
Now let's consider a special case where there are three brands (A, B, and C) of pens in the store,
but each with only one color style: black cap & black body. So the original model is modified as
follow.
$offtext
Sets
Brand /A, B, C/
CapColor /black/
;
alias(CapColor, BodyColor);
Table Price(Brand, CapColor, BodyColor)
black
A.black 1
B.black 8
C.black 9
;
Table ExpIndex(CapColor, BodyColor)
black
black 0.5
;
Binary Variables
x(Brand, CapColor, BodyColor)
;
Variables
Cost
Experience(Brand)
;
Equations
Constraint_1(Brand)
Constraint_2(Brand, CapColor, BodyColor)
Constraint_3(Brand)
ObjFunc
;
Constraint_1(Brand)..
sum(CapColor, sum(BodyColor, x(Brand, CapColor, BodyColor))) =e= 1;
Constraint_2(Brand, CapColor, BodyColor)$(ord(Brand) > 1)..
(1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor) * (x(Brand, CapColor, BodyColor) + x(Brand, BodyColor, BodyColor))
=e= (1 - x(Brand - 1, CapColor, CapColor)) * x(Brand - 1, CapColor, BodyColor);
Constraint_3(Brand)..
Experience(Brand) =e= sum(CapColor, sum(BodyColor, ExpIndex(CapColor, BodyColor) * x(Brand, CapColor, BodyColor)));
ObjFunc..
Cost =e= sum(Brand, sum(CapColor, sum(BodyColor, Price(Brand, CapColor, BodyColor) * x(Brand, CapColor, BodyColor))));
Model myPenSelecting /all/;
myPenSelecting.OptCR = 0;
*OPTION MINLP = BARON;
x.l(Brand, 'black', 'black') = 1;
Solve myPenSelecting using MINLP minimizing Cost;
If we solve this model with solver DICOP, the Solution Report will be
S O L V E S U M M A R Y
MODEL myPenSelecting OBJECTIVE Cost
TYPE MINLP DIRECTION MINIMIZE
SOLVER DICOPT FROM LINE 67
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 2 Locally Optimal
**** OBJECTIVE VALUE 18.0000
RESOURCE USAGE, LIMIT 0.000 1000.000
ITERATION COUNT, LIMIT 4 2000000000
EVALUATION ERRORS 0 0
while if we solve it with solver BARON, then the Solution Report is
S O L V E S U M M A R Y
MODEL myPenSelecting OBJECTIVE Cost
TYPE MINLP DIRECTION MINIMIZE
SOLVER BARON FROM LINE 67
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 19 Infeasible - No Solution
**** OBJECTIVE VALUE NA
RESOURCE USAGE, LIMIT 0.090 1000.000
ITERATION COUNT, LIMIT NA 2000000000
EVALUATION ERRORS 0 0
As we can see, DICOPT can give a locally optimal solution for the model, while BARON gets a conclusion that it is not feasible. Why?
Thank you very much for your time and patience. I am not sure if I have stated the problem clearly. Look forward to your help.