# TIMES.jl prototype

**URL:** <https://discourse.julialang.org/t/times-jl-prototype/120932>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [October 4, 2024, 5:16pm UTC](https://discourse.julialang.org/t/times-jl-prototype/120932 "2024-10-04T17:16:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![olejandro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olejandro/32/211825_2.png) [@olejandro](https://discourse.julialang.org/u/olejandro)\
**Post date:** [October 4, 2024, 5:16pm UTC](https://discourse.julialang.org/t/times-jl-prototype/120932/1 "2024-10-04T17:16:49Z")

</div>

Dear all,

Together with other members of the TIMES community, I’ve been working on a small [TIMES.jl](https://github.com/olejandro/times.jl) prototype translating a small number of [TIMES](https://github.com/etsap-TIMES/TIMES_model/) equations formulated in GAMS to Julia. Basically, this is a continuation of an earlier migration [feasibility study](https://iea-etsap.org/workshop/gothenburgh_june2018/11-TIMES-Migration_v03.pdf). I have no previous experience with Julia/JuMP and would appreciate any feedback on the [prototype](https://github.com/olejandro/times.jl) with respect to performance, structure, etc.

---

<div class="post-metadata">

**Author:** ![mtanneau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mtanneau/32/17787_2.png) [@mtanneau](https://discourse.julialang.org/u/mtanneau)\
**Post date:** [October 4, 2024, 8:49pm UTC](https://discourse.julialang.org/t/times-jl-prototype/120932/2 "2024-10-04T20:49:25Z")

</div>

Short note: you may find this post valuable when converting from GAMS to JuMP: [JuMP, GAMS, and the IJKLM model | JuMP](https://jump.dev/2023/07/20/gams-blog/)

---

<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:** [October 4, 2024, 8:53pm UTC](https://discourse.julialang.org/t/times-jl-prototype/120932/3 "2024-10-04T20:53:28Z")

</div>

Hi @olejandro, welcome to the forum 😄

I won’t have time to review this before next week, but I’ll point you to:

- [Design patterns for larger models · JuMP](https://jump.dev/JuMP.jl/dev/tutorials/getting_started/design_patterns_for_larger_models/)
- [Performance problems with sum-if formulations · JuMP](https://jump.dev/JuMP.jl/dev/tutorials/getting_started/sum_if/)

Have you benchmarked the performance and solution quality? Does it find the same solutions? How long does it take?

I’ll note that a one-to-one transliteration of GAMS to JuMP is not going to be magically faster, an will probably be a bit slower. The question is whether that is worth the trade-off for going open-source.

In the longer-term, Julia offers a number of features that aren’t in GAMS that might permit a larger architectural re-design that can both simplify the code and lead to better performance.

---

<div class="post-metadata">

**Author:** ![olejandro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olejandro/32/211825_2.png) [@olejandro](https://discourse.julialang.org/u/olejandro)\
**Post date:** [October 5, 2024, 1:02am UTC](https://discourse.julialang.org/t/times-jl-prototype/120932/4 "2024-10-05T01:02:30Z")

</div>

Thanks @mtanneau @odow

Yes, the solution is the same for the small model this is based on. A larger TIMES model may lack some constraints or have some differences in constraints.

In the current version of the prototype, model generation is probably about 2 times slower compared to GAMS (which is already much faster compared to the first versions e.g. see discussions [here](https://iea-etsap.org/forum/showthread.php?tid=246&page=2)). I already pre-calculate most of the equation/variable indices, but have not gotten rid of all the `if`s in summation statements yet.
