# \[ANN\] Announcing DICEModel.jl - DICE 2023 Integrated Assessment Model port to Julia

**URL:** <https://discourse.julialang.org/t/ann-announcing-dicemodel-jl-dice-2023-integrated-assessment-model-port-to-julia/125842>\
**Category:** Package Announcements\
**Created:** [February 12, 2025, 9:07pm UTC](https://discourse.julialang.org/t/ann-announcing-dicemodel-jl-dice-2023-integrated-assessment-model-port-to-julia/125842 "2025-02-12T21:07:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [February 12, 2025, 9:07pm UTC](https://discourse.julialang.org/t/ann-announcing-dicemodel-jl-dice-2023-integrated-assessment-model-port-to-julia/125842/1 "2025-02-12T21:07:19Z")

</div>

[DICEModel.jl](https://github.com/sylvaticus/DICEModel.jl) provides a practical, full open-source (using all open-source tools) implementation of the latest version of the Nordhaus’s DICE (Dynamic Integrated Climate-Economy model) model, keeping the model readable, compact and as close as possible to the original (GAMS) code.

This package provides two functions:

- `run_dice_scenario(scenario_name)` [[browse code](https://github.com/sylvaticus/DICEModel.jl/blob/main/src/Scenarios.jl) - [documentation](https://sylvaticus.github.io/DICEModel.jl/dev/api.html#DICEModel.run_dice_scenario-Tuple%7BString%7D) ] : runs one of the “official” 10 scenarios;

- `run_dice(;optimizer,bounds,kwargs...)` [[browse code](https://github.com/sylvaticus/DICEModel.jl/blob/main/src/DICEModel.jl) - [documentation](https://sylvaticus.github.io/DICEModel.jl/dev/api.html#DICEModel.run_dice-Tuple%7B%7D)] : run DICE with custom solver engine (and eventually options), custom variable constraints (bounds) or custom parameters (see [Parameters](https://sylvaticus.github.io/DICEModel.jl/dev/api.html#DICEModel.RawParameters)).

In both cases the output (results) is a named tuple. Use `keys(results)` to find the available information (or just look at the source code) and `results.VARIABLEX` to obtain the values.

A summary of the main results is available [on this page](https://sylvaticus.github.io/DICEModel.jl/dev/results.html).

## Example

```julia

using Pkg

Pkg.activate(@ __DIR__ )

Pkg.add(["DICEModel","Plots"]) # run only once, then comment out

using DICEModel, Plots

# CB Optimal scenario...

res_cbopt = run_dice_scenario("cbopt")

# Base scenario...

res_base = run_dice_scenario("base")

# Paris "extended" scenario...

tidx = 1:81

# upper limit to emissions mitigation rate

miuup = @. min( 0.05 + 0.04*(tidx-1) - 0.01*max(0,tidx-5) ,1.00)

res_parisext = run_dice(miuup = miuup) # or simply: run_dice_scenario("parisext")

# Max 2 °C scenario...

res_t2c = run_dice(bounds = Dict("TATM"=>("<=",2.0))) # or simply: run_dice_scenario("t2c")

# Plots

times = res_cbopt.times

# CO2 emissions plot...

plot(times[1:11],res_cbopt.ECO2[1:11],ylim=(0,70), title="CO₂ emissions",ylabel="GtCO₂/yr",label="C/B optimal", color=:blue4, markershape=:circle, markercolor=:white)

plot!(times[1:11],res_base.ECO2[1:11], label="Base", colour=:goldenrod3, markershape=:circle, markercolor=:goldenrod3)

plot!(times[1:11],res_parisext.ECO2[1:11], label="Paris ext", colour=:red, linestyle=:dash)

plot!(times[1:11],res_t2c.ECO2[1:11], label="T < 2 °C", colour=:green, markershape=:cross, markercolor=:green)

# Carbon price plot...

plot(times[1:9],res_cbopt.CPRICE[1:9],ylim=(0,300), title="Carbon price",ylabel="2019\$ / t tCO₂",label="C/B optimal", color=:blue4, markershape=:circle, markercolor=:white)

plot!(times[1:9],res_base.CPRICE[1:9], label="Base", colour=:goldenrod3, markershape=:circle, markercolor=:goldenrod3)

plot!(times[1:9],res_parisext.CPRICE[1:9], label="Paris ext", colour=:red, linestyle=:dash)

plot!(times[1:9],res_t2c.CPRICE[1:9], label="T < 2 °C", colour=:green, markershape=:cross, markercolor=:green)

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/a/1/a13b4f6ba018b40c3015d6222209da1ec536a519.png) ![](https://global.discourse-cdn.com/julialang/original/3X/d/2/d23206a002cf6449e549bb6d521aa2706d66478b.png)

## Other packages or implementations of the DICE model

Other packages, in both Julia and other languages, already implement the DICE model, but often don’t have the same level of readability and compactness as the original GAMS code:

- [DuBois Julia implementation](https://github.com/Libbum/DICE.jl): There are no updates to DICE 2023, and the code divided in many pieces;

- MIMI framework based implementations (eg. [v2016](https://github.com/AlexandrePavlov/MimiDICE2016.jl) or [v2016R2](https://github.com/anthofflab/MimiDICE2016R2.jl)): There are no updated to DICE 2023, the code is divided in many pieces (different implementation and solver structure)

- [olugovoy implementation in various languages (Julia included)](https://github.com/olugovoy/climatedice): No updates, code looks very “R like”

- [Benet and Akshay MATLAB implementation](https://github.com/ebenetce/DICE2023) : Still requires MATLAB, code not readable/compact as GAMS or JuMP

- [Nie and Welch Python implementation](https://ivo-welch.info/research/dice/header.html) : Code not readable/compact as GAMS or JuMP

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [April 29, 2025, 2:14pm UTC](https://discourse.julialang.org/t/ann-announcing-dicemodel-jl-dice-2023-integrated-assessment-model-port-to-julia/125842/2 "2025-04-29T14:14:15Z")

</div>

Version 0.2 of DICEModel.jl is out.  
I generalised/regionalised DICE, so that “DICE2023” is now a RICE with a single region.  
A parametrization of the multi-regional version to match the official RICE is attempted, but I still have odd results, most presumably by some odd parametrisation.  
Results seems to depend, in my version, on the number of (equal) regions the World is partitioned to, that doesn’t make too much sense:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/2/f25250c586e2308cca2db43c6b451f8a75703138.png)
