“Dharma Academy MindOpt” is used for multi-objective planning (goal planning method)

In the previous article, we talked about using the weighted sum method to optimize multi-objective programming problems. This article will talk about using the goal programming method.

1. Principle

The goal planning method first sets an expected value (target value) for each objective function.

g

i

g_i

gi?.

Option 1: Then construct a new objective function

F

(

x

)

F(x)

F(x), its form is as follows:

minimize

F

(

x

)

=

[

w

i

?

f

i

(

x

)

?

g

i

]

\text{minimize} \quad F(x) = \sum [w_i * |f_i(x) – g_i|]

minimizeF(x)=∑[wi∣fi?(x)?gi?∣].
in,

w

i

w_i

wi? means the first

i

i

The weights of i objective functions. by minimizing

F

(

x

)

F(x)

F(x) can achieve multi-objective reconciliation while satisfying various constraints. This distance can also be passed

L

2

L_2

L2? norm to express. This method is somewhat similar to the weighted sum method.

Option 2: We can also set goals into constraints (similar to the analytic hierarchy process) and set high-priority goals as constraints to reduce the number of objective functions. That is, add it to the constraints

f

1

(

x

)

=

g

1

f_1(x) = g_1

f1?(x)=g1?.

2. Give examples

Using the same farmer problem as before:

Suppose a farmer wants to optimize the layout of crops on his land and needs to balance the following two goals:

  • Goal 1: Maximize farm output value (unit: yuan);
  • Objective 2: Minimize fertilizer usage (unit: kilogram).

The farmer has two crops to grow: Crop A, Crop B, and Crop C. set up

x

1

x_1

x1?、

x

2

x_2

x2?、

x

3

x_3

x3? are the areas for planting crops A, B, and C respectively.

  • It is known that the output values of crops A, B, and C per mu are 1,000 yuan, 1,200 yuan, and 1,300 yuan respectively. Then, the function of objective 1:

    maximize

    F

    1

    (

    x

    )

    =

    1000

    ?

    x

    1

    +

    1200

    ?

    x

    2

    +

    1300

    ?

    x

    3

    \text{maximize} \quad F_1(x) = 1000 \cdot x_1 + 1200 \cdot x_2 + 1300 \cdot x_3

    maximizeF1?(x)=1000?x1? + 1200?x2? + 1300?x3?.

  • Crops A, B, and C require 20 kilograms, 30 kilograms, and 33 kilograms of chemical fertilizers per mu respectively. Then, the function of objective 2:

    minimize

    F

    2

    (

    x

    )

    =

    20

    ?

    x

    1

    +

    30

    ?

    x

    2

    +

    33

    ?

    x

    3

    \text{minimize} \quad F_2(x) = 20 \cdot x_1 + 30 \cdot x_2 + 33 \cdot x_3

    minimizeF2?(x)=20?x1? + 30?x2? + 33?x3?.

  • The total planting area does not exceed 100 acres. Right now,

    x

    1

    +

    x

    2

    +

    x

    3

    100

    x_1 + x_2 + x_3 \leq 100

    x1? + x2? + x3?≤100.

  • Each of the three crops needs to be planted on at least 10 acres.

2.1. Set target values

When we don’t know what target value to set, we can also solve the optimal solution of each single objective, observe the value, and then set the target value.

For example, we use the MindOpt APL modeling language to model this problem and call the MindOpt Solver to solve it. code show as below:

# =================Target 1========================


clear model;

# ------Modeling-------Start-----
# model_2_1.mapl

#Variables
var x1 >= 10;
var x2 >= 10;
var x3 >= 10;

# Target
maximize obj: (1000 * x1 + 1200 * x2 + 1300 * x3);

#Define constraints
subject to constraint1: x1 + x2 + x3 <= 100;
# ------Modeling-------End-----

#solve
option solver mindopt; # (optional) Specify the solver used for solution, the default is MindOpt
option mindopt_options 'print=0'; #Set the solver output level to reduce process printing
solve; # solve

# Result printing and checking results
print "-----------------Display---------------";
display;
print "Among them, species", x1,"acre of crop A, species",x2,"acre of crop B, species",x3,"acre of crop C.";
print "Corresponding farm output value:", (1000 * x1 + 1200 * x2 + 1300 * x3),"Kilograms.";

# =================Target 2========================

clear model;

# ------Modeling-------Start-----
# model_2_2.mapl

#Variables
var x1 >= 10;
var x2 >= 10;
var x3 >= 10;

# Target
minimize obj: (20 * x1 + 30 * x2 + 33 * x3);

#Define constraints
subject to constraint1: x1 + x2 + x3 <= 100;
# ------Modeling-------End-----

#solve
option solver mindopt; # (optional) Specify the solver used for solution, the default is MindOpt
option mindopt_options 'print=0'; #Set the solver output level to reduce process printing
solve; # solve

# Result printing and checking results
print "-----------------Display---------------";
display;
print "Among them, species", x1,"acre of crop A, species",x2,"acre of crop B, species",x3,"acre of crop C.";
print "Corresponding fertilizer usage:", (20 * x1 + 30 * x2 + 33 * x3),"Kilograms.";

The result of running the above code is as follows:

Running mindoptampl
wantsol=1
print=0
MindOpt Version 0.25.1 (Build date: 20230816)
Copyright (c) 2020-2023 Alibaba Cloud.

Start license validation (current time : 13-OCT-2023 15:54:20).
License validation terminated. Time: 0.004s


OPTIMAL; objective 126000.00
0 simplex iterations

Completed.
------------------Display--------------
Primal solution:
      x1 = 10.0000000
      x2 = 10.0000000
      x3 = 80.0000000
Among them, 10 acres are planted to crop A, 10 acres are planted to crop B, and 80 acres are planted to crop C.
Corresponding farm output value: 126,000 kilograms.
Running mindoptampl
wantsol=1
print=0
MindOpt Version 0.25.1 (Build date: 20230816)
Copyright (c) 2020-2023 Alibaba Cloud.

Start license validation (current time : 13-OCT-2023 15:54:20).
License validation terminated. Time: 0.004s


OPTIMAL; objective 830.00
0 simplex iterations

Completed.
------------------Display--------------
Primal Solution:
      x1 = 10.0000000
      x2 = 10.0000000
      x3 = 10.0000000
Among them, 10 acres of crop A are planted, 10 acres of crop B are planted, and 10 acres of crop C are planted.
Corresponding fertilizer usage: 830 kg.

As can be seen from the above, the optimal value of goal 1 is 126,000 kilograms, and the optimal value of goal 2 is not to plant excess and only consume 830 kilograms. Next we use these two values as targets.

2.2. Method 1: Set optimization target distance

Considering the value range of the variable, here we directly use the (large number – decimal) method to express the distance.

Then similar to the weighted sum method, we introduce two weight parameters

w

1

w_1

w1?and

w

2

w_2

w2?, respectively represent the importance of farm output value and fertilizer usage, and satisfy

w

1

+

w

2

=

1

w_1 + w_2 = 1

w1? + w2?=1, and then considering that the units and data magnitudes of the two targets are different, we introduce parameters

c

c

c to adjust the order of magnitude for target 2.

The MAPL code is as follows:

# ================= Set target after conversion =======================

clear model;

# ------Modeling-------Start-----
# model_2_3.mapl

#Variables
var x1 >= 10;
var x2 >= 10;
var x3 >= 10;

# Weight parameter
param w1 = 0.7; # Assume that the farmer is more concerned about the farm output value
param w2 = 1 - w1;
param c = 50; # Simple estimate based on the order of magnitude difference 1000/20 = 50


# Target
minimize obj: w1 *(126000 - (1000 * x1 + 1200 * x2 + 1300 * x3)) + c*w2*((20 * x1 + 30 * x2 + 33 * x3) - 830);

#Define constraints
subject to constraint1: x1 + x2 + x3 <= 100;
# ------Modeling-------End-----

#solve
option solver mindopt; # (optional) Specify the solver used for solution, the default is MindOpt
option mindopt_options 'print=0'; #Set the solver output level to reduce process printing
solve; # solve

# Result printing and checking results
print "-----------------Display---------------";
display;

print "The single-objective optimization of the transformation is:",w1 *(126000 - (1000 * x1 + 1200 * x2 + 1300 * x3)) + c*w2*((20 * x1 + 30 * x2 + 33 * x3) - 830);
print "Among them, species", x1,"acre of crop A, species",x2,"acre of crop B, species",x3,"acre of crop C.";
print "Corresponding farm output value:", (1000 * x1 + 1200 * x2 + 1300 * x3),"Yuan.";
print "Corresponding fertilizer usage:", (20 * x1 + 30 * x2 + 33 * x3),"Kilograms.";

The result of running the code is as follows:

Running mindoptampl
wantsol=1
print=0
MindOpt Version 0.25.1 (Build date: 20230816)
Copyright (c) 2020-2023 Alibaba Cloud.

Start license validation (current time : 13-OCT-2023 15:55:49).
License validation terminated. Time: 0.006s


OPTIMAL; objective 34650.00
0 simplex iterations

Completed.
------------------Display--------------
Primal solution:
      x1 = 10.0000000
      x2 = 10.0000000
      x3 = 80.0000000
The optimal single target of the transformation is: 34650.00000000001
Among them, 10 acres are planted to crop A, 10 acres are planted to crop B, and 80 acres are planted to crop C.
Corresponding farm output value: 126,000 yuan.
Corresponding fertilizer usage: 3140 kg.

As can be seen from the above, in this case, the target transformation is similar to the previous weighted sum method.

2.3. Option 2: Use the target as a constraint to solve the optimal problem

In addition to modifying the goal, we can also improve the constraints. Observe the optimal values of the above objective function:

  • F

    1

    (

    x

    )

    F_1(x)

    The optimal value of F1?(x) is: plant 10 acres of crop A, plant 10 acres of crop B, and plant 80 acres of crop C. Corresponding farm output value: 126,000 kilograms.

  • F

    2

    (

    x

    )

    F_2(x)

    The optimal value of F2?(x) is: plant 10 acres of crop A, plant 10 acres of crop B, and plant 10 acres of crop C. Corresponding fertilizer usage: 830 kg.

Here we will

F

1

(

x

)

F_1(x)

The optimal value of F1?(x) is used as a constraint, and the transformation is as follows:

# ================= Set target after conversion =======================

clear model;

# ------Modeling-------Start-----
# model_2_3.mapl

#Variables
var x1 >= 10;
var x2 >= 10;
var x3 >= 10;

# Target
minimize obj: 20 * x1 + 30 * x2 + 33 * x3; # only F2(x)

#Define constraints
subject to constraint1: x1 + x2 + x3 <= 100;

subject to constraint_new: (1000 * x1 + 1200 * x2 + 1300 * x3) == 126000 ;

# ------Modeling-------End-----

#solve
option solver mindopt; # (optional) Specify the solver used for solution, the default is MindOpt
option mindopt_options 'print=0'; #Set the solver output level to reduce process printing
solve; # solve

# Result printing and checking results
print "-----------------Display---------------";
display;

print "Among them, plant {:.9g} acres of crop A, plant {:.9g} acres of crop B, plant {:.9g} acres of crop C." % x1,x2,x3;
print "Corresponding farm output value:", (1000 * x1 + 1200 * x2 + 1300 * x3),"Yuan.";
print "Corresponding fertilizer usage:", (20 * x1 + 30 * x2 + 33 * x3),"Kilograms.";

The result of running the code is as follows:

Running mindoptampl
wantsol=1
print=0
MindOpt Version 0.25.1 (Build date: 20230816)
Copyright (c) 2020-2023 Alibaba Cloud.

Start license validation (current time : 13-OCT-2023 15:56:49).
License validation terminated. Time: 0.006s


OPTIMAL; objective 3140.00
3 simplex iterations

Completed.
------------------Display--------------
Primal Solution:
      x1 = 10.0000000
      x2 = 10.0000000
      x3 = 80.0000000
Among them, 10 acres are planted to crop A, 10 acres are planted to crop B, and 80 acres are planted to crop C.
Corresponding farm output value: 126,000 yuan.
Corresponding fertilizer usage: 3140 kg.

If the optimal value of the second objective is set into the constraints, the result will be somewhat inappropriate. as follows:

# ================= Set target after conversion =======================

clear model;

# ------Modeling-------Start-----
# model_2_3.mapl

#Variables
var x1 >= 10;
var x2 >= 10;
var x3 >= 10;

# Target
minimize obj: (1000 * x1 + 1200 * x2 + 1300 * x3); # only F1(x)

#Define constraints
subject to constraint1: x1 + x2 + x3 <= 100;

subject to constraint_new: (20 * x1 + 30 * x2 + 33 * x3) == 830 ;

# ------Modeling-------End-----

#solve
option solver mindopt; # (optional) Specify the solver used for solution, the default is MindOpt
option mindopt_options 'print=0'; #Set the solver output level to reduce process printing
solve; # solve

# Result printing and checking results
print "-----------------Display---------------";
display;

print "Among them, plant {:.9g} acres of crop A, plant {:.9g} acres of crop B, plant {:.9g} acres of crop C." % x1,x2,x3;
print "Corresponding farm output value:", (1000 * x1 + 1200 * x2 + 1300 * x3),"Yuan.";
print "Corresponding fertilizer usage:", (20 * x1 + 30 * x2 + 33 * x3),"Kilograms.";

The running results are as follows:

Running mindoptampl
wantsol=1
print=0
MindOpt Version 0.25.1 (Build date: 20230816)
Copyright (c) 2020-2023 Alibaba Cloud.

Start license validation (current time : 29-AUG-2023 11:35:49).
License validation terminated. Time: 0.007s


OPTIMAL; objective 35000.00
0 simplex iterations

Completed.
------------------Display--------------
Primal Solution:
      x1 = 10.0000000
      x2 = 10.0000000
      x3 = 10.0000000
Among them, 10 acres of crop A are planted, 10 acres of crop B are planted, and 10 acres of crop C are planted.
Corresponding farm output value: 35,000 yuan.
Corresponding fertilizer usage: 830 kg.

3.Analysis and improvement

As you can see from above:

  • Set directly into the target, the effect will be similar to the weighted sum method.
  • If you set constraints, it is a different idea and you can also get a solution. The principle is similar to setting priorities for different goals. However, choosing different targets for constraints will lead to inappropriate results.

Therefore, it is recommended to try more when converting multiple targets. The following improvement ideas can be considered:

  • Combined with other methods: For example, combined with the weighting method, the weights between each goal can be better balanced while taking into account goal priority.
  • Solve multiple solutions: Try using different combinations of goal priorities or weights to generate multiple solutions. These solutions can provide multiple options to help find a satisfactory balance point in practical applications.
  • Use interactive methods: In practical applications, interactive methods can be used to allow decision makers to participate in the optimization process. In each iteration, decision makers can provide feedback based on the current solution. Based on feedback from decision makers, goal priorities or weights can be adjusted to gradually find a satisfactory solution over multiple iterations.