Problem
To assemble a radio any of three types (T1,T2,T3) of tubes can be used. The box may be either of wood W or of plastic material P. When using P, then dimensionality requirements impose the choice of T2 and a special power supply F (since there is no space for a transformer S). T1 needs F. When T2 or T3 is chosen then we need S and not F. The price of each component is given. A radio made of wood or of plastic has different selling prices. Should we build a radio of wood or of plastic when we want to maximize profit? (The problem is from [11]).
Modeling Steps
This model shows how mathematical and logical constraints can be used side by side.
There are 7 possible components that are used to build a radio. For each component a binary variable is introduces, that says whether to use it or not to build our radio.
The constraints easy to derive. The objective function is the selling prices minus the costs of all components. Since the radio is either of wood or plastic only one of the variable W or P is differnt from zero.
model Radio "Assembling a Radio";
binary variable
T1 "Tube of type I";
T2 "Tube of type II";
T3 "Tube of type III";
W "a wooden box";
P "a plastic box";
F "a transformator";
S "a special power supply";
constraint
R1: T1+T2+T3=1 "Use one tube";
R2: W xor P "Wood or plastic?";
R3: P -> T2 and S "If Plastic then use T2 and S";
R4: T1 -> F "T1 needs a transformator";
R5: T2 or T3 -> S "When choosing T2 or T3, we need S";
R6: F xor S "Either F or S must be used";
expression cost:=55*T1+58*T2+56*T3+25*F+23*S+9*W+6*P+10;
maximize Profit: 110*W + 105*P - cost;
Write('The profit is: %d, the radio is made of '
%s.' n',Profit,if(W,'wood','plastic'));
end
Solution
The profit for one radio made of wood is 12. It uses tube III and a special power supply.
Questions
What is the profit if the radio is made of plastic?
Answers