This is a small tool that converts scalar optimization model with different formats into a JuMP model script (.jl
). The scalar model is unlike a modeling script that carries the model information with sets, looped-constraints, and complex index variables. You will find this tools useful when benchmarking your algorithm using established instance libraries. Please see some of the converted MINLP instances in MINLPLibJuMP.jl.
This is a developing repo as more formats and exceptions are considered. The mission is to provide
correct and flexible conversion to JuliaOpt
users.
Pkg.clone("https://github.com/jac0320/toJuMP.jl.git")
gms2jump("*.gms")
mod2jump("*.mod")
The default output path is Pkg.dir()/toJuMP/.jls/
. Multiple options are provided for conversions. The default output path is Pkg.dir()/toJuMP/.jls/
.For example,
gms2jump("*.gms", mode="index", ending="m=m", quadNL=true, outdir="", loopifpossible=true)
-
mode
: ("raw"
or"index"
) index method for variables. If"raw"
, then variables will not be indexed and original script variable string ("x15"
,"i26"
) is defined. If"index"
, then index will be used to construct variables such as"x[15]"
or"i[26]"
. -
ending
: control of the ending line of generated scrip. By default, this is"m=m"
, which means when you include the generated script, the JuMP model will be returned. -
quadNL
: build quadratic model using@NLconstraint
. By default (JuMP 0.18-),@constraint
can handle quadratic constraints by automatically expand the expression. User can choose to keep the original expression through@NLconstraint
, which will yields a nonlinear JuMP model type. -
outdir
: user-defined output dir for.jl
files. No need to give the problem name. -
loopifpossible
: write variables attributes (bounds, warm-start values using loops if possible).
-
Supports for dual warm start is temporarily disabled (will consider with JuMP 0.19)
-
Semi-continous variables is not supported
-
Unsupported operators:
arctan
,ceil
,errorof
,floor
,mapval
,max
,min
,mod
,normal
,round
,sign
,trunc
,uniform
. These variables are disabled since they can be achieved through various modeling techniques. Currently,toJuMP.jl
does not assume/apply these modeling techniques by default. -
Variable attributes such as
scale
,prior
,stage
is disabled given these are solver-dependent attributes.