jump-dev / jump-dev/JuMP.jl

Add support for modeling with SI units

Open
#1,350 21 comments 4 reactions 0 assignees View on GitHub
Category: Extensions Type: Enhancement Type: Feature request
Dominant language
Julia
Stars
2.5k
Forks
428
Avg merge
18h 10m
Merged PRs (30d)
28

Description

Something that has been mentioned before in passing and might be worth discussing down the track: allow modeling with SI units using https://github.com/ajkeller34/Unitful.jl. It may be fairly trivial, I'm not sure.

DifferentialEquations.jl seems to allow this, for example [here](https://github.com/JuliaDiffEq/DiffEqTutorials.jl/blob/719c21cd76d8133b9f6a62ecceb10dfcccd24123/ExtraODEFeatures/.ipynb_checkpoints/Unit%20Checked%20Arithmetic%20via%20Unitful-checkpoint.ipynb).

GPKit is a geometric programming toolkit in Python and it [supports specification of units](https://gpkit.readthedocs.io/en/latest/gettingstarted.html?highlight=units) and automatically does dimensional analysis to convert or verify units in expressions/constraints. From the GPKit docs, an example of a variable declaration:
```julia
# Declare a variable, z, with units of meters, and a description
z = Variable("z", "m", "A variable called z with units of meters")
```
and a simple model:
```julia
# consider a block with dimensions x, y, z less than 1
# constrain surface area less than 1.0 m^2
x = Variable("x", "m")
y = Variable("y", "m")
z = Variable("z", "m")
S = Variable("S", 1.0, "m^2")
c = (2*x*y + 2*x*z + 2*y*z <= S)
```
(There are other ideas we could borrow from GPKit to make JuMP even more user friendly. I like the little solution tables it can print after a solve.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.