# Customised Objective Function using PMD.jl

**URL:** <https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, jump\
**Created:** [February 24, 2025, 4:38pm UTC](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253 "2025-02-24T16:38:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alireza33zz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alireza33zz/32/215433_2.png) [@alireza33zz](https://discourse.julialang.org/u/alireza33zz)\
**Post date:** [February 24, 2025, 4:38pm UTC](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253/1 "2025-02-24T16:38:38Z")

</div>

Hello  
I am using PowerModelsDistribution.jl to solve my 3-phase OPF, how can I only change the objective function? By default it is the minimization of fuel cost, I want to replace it with a non-linear function.

Thanks in advance.

---

<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:** [February 24, 2025, 7:12pm UTC](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253/2 "2025-02-24T19:12:15Z")

</div>

Hi @alireza33zz, welcome to the forum.

See [Getting Started · PowerModelsDistribution](https://lanl-ansi.github.io/PowerModelsDistribution.jl/stable/manual/quickguide.html#Inspecting-the-Formulation)

The `pm` power model that you get from `instantiate_model` has a `.model` field that is a JuMP model. You can change this objective using `JuMP.@objective(pm.model, Min, ... expression goes here...)`.

---

<div class="post-metadata">

**Author:** ![alireza33zz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alireza33zz/32/215433_2.png) [@alireza33zz](https://discourse.julialang.org/u/alireza33zz)\
**Post date:** [February 26, 2025, 5:58pm UTC](https://discourse.julialang.org/t/customised-objective-function-using-pmd-jl/126253/3 "2025-02-26T17:58:28Z")

</div>

> [@odow](#):
>
> JuMP.@objective(pm.model, Min, … expression goes here…)

Thank you for your reply, it was a good point to start.
