# Blended Objectives/Linear Combination

**URL:** <https://discourse.julialang.org/t/blended-objectives-linear-combination/88016>\
**Category:** Optimization (Mathematical)\
**Created:** [September 30, 2022, 12:57am UTC](https://discourse.julialang.org/t/blended-objectives-linear-combination/88016 "2022-09-30T00:57:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sophiepavia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sophiepavia/32/37488_2.png) [@sophiepavia](https://discourse.julialang.org/u/sophiepavia)\
**Post date:** [September 30, 2022, 12:57am UTC](https://discourse.julialang.org/t/blended-objectives-linear-combination/88016/1 "2022-09-30T00:57:35Z")

</div>

I am writing a optimization problem where I have a Utilitarian objective and MaxMin Objective. I want to have a third objective that is a linear combination of the two aka a blended objective. I am using Gurobi. My model is defined as follows

`model = Model(Gurobi.Optimizer)`

I see that Gurobi supports blended objectives, but does julia?

If it does, how would I go about implementing this? For example here are my Utilitarian and MaxMin objectives where `u[r]` is a decision variable and the rest are static variables

`@objective(model, Max, sum(b_dict[r] * (p_dict[r] * u[r]) for r in od))`

```julia
for r in od
     @constraint(model, t <= p_dict[r] * u[r])
end
@objective(model,Max, t)
```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 30, 2022, 1:06am UTC](https://discourse.julialang.org/t/blended-objectives-linear-combination/88016/2 "2022-09-30T01:06:18Z")

</div>

JuMP does not support multi-objective problems.

When you write

```julia
@objective(model, Max, x)
@objective(model, Max, y)

```

we are replacing the single objective, not adding a new one.

For your “blended” objective, I assume you mean something like a weighted-sum approach? I would do something like this:

```julia
@variable(model, obj[1:2])
@constraint(model, obj[1] <= sum(b_dict[r] * (p_dict[r] * u[r]) for r in od))
for r in od
     @constraint(model, obj[2] <= p_dict[r] * u[r])
end
l = 0.5
@objective(model, Max, l * obj[1] + (1 - l) * obj[2])

```

By varying `l` between `0.0` and `1.0`, you can recover the support non-dominated points of the Pareto frontier (if the problem is a linear program. If MIP, things are more difficult).

For other approaches:

- Gurobi.jl has support for multiple objectives at the MOI level, [Gurobi.jl/MOI\_multiobjective.jl at master · jump-dev/Gurobi.jl · GitHub](https://github.com/jump-dev/Gurobi.jl/blob/master/test/MOI/MOI_multiobjective.jl), but not at the JuMP level.
- Try vOptSolver: [vOptSolver (vOpt) · GitHub](https://github.com/vOptSolver)

---

<div class="post-metadata">

**Author:** ![sophiepavia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sophiepavia/32/37488_2.png) [@sophiepavia](https://discourse.julialang.org/u/sophiepavia)\
**Post date:** [September 30, 2022, 1:08am UTC](https://discourse.julialang.org/t/blended-objectives-linear-combination/88016/3 "2022-09-30T01:08:08Z")

</div>

This is exactly what I meant. Thank you!
