Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efficient solution/non-dominated point missing with MOA.Lexicographic() #58

Closed
xgandibleux opened this issue Apr 9, 2023 · 1 comment · Fixed by #59
Closed

efficient solution/non-dominated point missing with MOA.Lexicographic() #58

xgandibleux opened this issue Apr 9, 2023 · 1 comment · Fixed by #59

Comments

@xgandibleux
Copy link

For the following 2IP problem:

max z_1  =  x_1  +  x_2  
min z_2  =  x_1  +  3x_2
s.t. 
      2x_1  +   3x_2  <= 30 
      3x_1  +   2x_2  <= 30 
       x_1  +    x_2  <= 5.5 
       x_1  ,    x_2  \in  \mathbb{N}

The lexicographic algorithm returns only one solution, the x=(0,0) corresponding to z=(0,0) is missing.
The code is the following:

using JuMP
import MultiObjectiveAlgorithms as MOA
using GLPK
using Printf


# Setup the model ------------------------------------------------------------
model = Model( )

# Define the variables 
@variable(model, x1≥0, Int)
@variable(model, x2≥0, Int)

# Define the objectives 
@expression(model, fct1, x1 + x2)      # to maximize
@expression(model, fct2, x1 + 3 * x2)  # to minimize
@objective(model, Max, [fct1, (-1) * fct2])

# Define the constraints 
@constraint(model, 2*x1 + 3*x2 ≤ 30)
@constraint(model, 3*x1 + 2*x2 ≤ 30)
@constraint(model,   x1 -   x2 ≤ 5.5)


# Setup the solver (lexicographic method) ------------------------------
set_optimizer(model,()->MOA.Optimizer(GLPK.Optimizer))
set_attribute(model, MOA.Algorithm(), MOA.Lexicographic())

        
# Solve and display results ---------------------------------------------------
optimize!(model)

for i in 1:result_count(model)
    z1_opt = objective_value(model; result = i)[1]
    z2_opt = -1 * objective_value(model; result = i)[2]
    x1_opt = value(x1; result = i)
    x2_opt = value(x2; result = i)   
    @printf( "%2d  :  z = [%3.0f ,%3.0f]  |  x1 =%2.0f  x2 =%2.0f\n", i, z1_opt, z2_opt, x1_opt, x2_opt )    
end

returns:

 1  :  z = [ 12 , 24]  |  x1 = 6  x2 = 6

The decision space and the objective space for this 2IP are:
X
Y

@xgandibleux
Copy link
Author

In looking carefully the implementation of the lexicographic algorithm, the problem that I reported is fixed using the option all_permutations = true as follow:

set_attribute(model, MOA.Algorithm(), MOA.Lexicographic(all_permutations = true))

I would suggest to setup the option to 'true' by default, since invoking 'a lexicographic resolution' it is usual to treat the $p$ objectives of the problem, and not only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant