Problem
Coal, gas and nuclear fuel can be imported in order to satisfy the energy demands of a country. Three grades of gas and coal (low, medium, high) and one grade of nuclear fuel may be imported. The costs are known. Furthermore, there are upper and lower limits in the imported quantities from a country. What quantities should be imported if the import cost have to be minimized? (The model is from [10]). In addition, three additional conditions must be fulfilled:
A supply condition: Each country can supply either up to three (non-nuclear) low or medium grade fuels or nuclear fuel and one high grade fuel.
Environmental restriction: Environmental regulations require that nuclear fuel can be used only if medium and low grades of gas and coal are excluded.
Energy mixing condition: If gas is imported then either the amount of gas energy imported must lie between 40-50 percent and the amount of coal energy must be between 20-30 percent of the total energy imported or the quantity of gas energy must lie between 50-60 percent and coal is not imported.
Modeling Steps
Three index-set define are defined: i ∈ I = {low, medium, high} the grade fuel, j ∈ J = {coal, gas} the non-nuclear energy sources, and k ∈ K = {GR, FR, IC} the countries from where to import. Nuclear energy is treated apart because it come only in one grade.
The data are defined and explained in the model code (see parameter section).
We first introduce two continuous variables: the quantity of non-nuclear fuel (x_{i,j,k}) and the quantity of nuclear fuel (y_{k}).
The sum of all imports must be the desired energy amount e. Hence we have
The import costs are to be minimized. Hence:
The three logical requirements are modeled as follows. Boolean predicates (binaries) are introduced to link the mathematical with the logical part of the model. Let P_{i,j,k} be a predicate with the definition: “If at least l_{i,j,k} or at most u_{i,j,k} of non-nuclear energy is imported then P_{i,j,k}”. For the nuclear energy a similar definition is introduced: “If at least nl_{k} or at most nu_{k} of nuclear energy is imported then N_{k}”. We have:
In condition 3, two other predicates are needed: “If the total amount of non-nuclear imported fuel, lays between 40-50% for gas and 20-30% for coal of the total imported non-nuclear fuel then Q_{j}”, and “if imported gas is between 50-60% of the total imported non-nuclear fuel then R”. Hence:
Using these predicates, the three conditions are formulated as follows:
“For each country k, either at most 3 of P_{i,j,k} (with i ⁄= ′high′) are true or N_{k} is true and exactly one P_{′high′,j,k} is true”
“At least one N_{k} is true, only if none of P_{i,j,k} is true (with i ⁄= ′high′)” and
“If any of P_{i,′gas′,k} is true, then either Q_{j} is true or R is true and none of P_{i,′coal′,k} is true.
Some remarks on the formulations
The first condition has the form: “for each k, either A or B”. Normally, “either ... or” is translated as exclusive or, but sometimes we just mean or (non-exclusive). It depends on the context. Here we want to say that A and B cannot both be true at the same time. Therefore we have: AB.
The second condition has the form: “A only if B” which is simply A → B.
The third condition has the form: “If A then (either B or (C and D))”, which is A → (B (C ∧ D)).
model ImportEnergy "Importing Energy";
set
i := [low med high] "Quality grades of energy";
j := [gas, coal] "Non-nuclear energy sources";
k := [GB FR IC] "Countries exporting energy";
parameter
c{i,j,k} "Non-nuclear energy cost";
l{i,j,k} "Lower bound on the quantity of non-nuclear energy";
u{i,j,k} "Upper bound on the quantity of non-nuclear energy";
nc{k} "Nuclear energy cost";
nl{k} "Lower bound on the quantity of nuclear energy";
nu{k} "Upper bound on the quantity of nuclear energy";
e "Desired energy amount to import";
L{j} "Min percent of energy if coal and gas are imported";
U{j} "Max percent of energy if coal and gas are imported";
A "Min percent of gas if gas energy only is imported";
B "Max percent of gas if gas energy only is imported";
variable
x{i,j,k} [0..u] "Quantity of non-nucl energy imported";
y{k} [0..nu] "Quantity of nucl energy imported";
binary variable
P{i,j,k} <- l<=x;
N{k} <- nl<=y;
Q{j} <- e*L <= sum{i,k} x <= e*U;
R <- e*A <= sum{i,k} x[i,'gas',k] <= e*B;
constraint
ImportReq : sum{i,j,k} x + sum{k} y = e;
C1{k}: atmost(3){i,j|i<>'high'} P xor (N and
xor{j} P['high',j,k]);
C2: or{k} N -> nor{i,j,k|i<>'high'} P;
C3: or{i,k}P[i,'gas',k] -> and{j}Q xor R and
nor{i,k}P[i,'coal',k];
minimize Cost: sum{i,j,k} c*x + sum{k} nc*y;
Writep(Cost,x,y,P,N,Q,R);
model data;
e := 12000;
c{i,j,k} := Rnd(1,4); nc{k} := Rnd(1,3);
l{i,j,k} := Rnd(10,40); u{i,j,k} := Rnd(1000,2000);
nl{k} := Rnd(20,30); nu{k} := Rnd(1000,5000);
L{j} := [0.20 0.40]; U{j} := [0.30 0.50];
A := 0.50; B := 0.60;
end
end