Skip to content

jac0320/toJuMP.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toJuMP.jl

Dev: Build Status codecov

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.

Installation

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")

Usage

.gms --> .jl

gms2jump("*.gms")

.mod --> .jl

mod2jump("*.mod")

.nl --> .jl (upcoming)

Conversion options

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).

Known Issues

  • 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.

Tested Library

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published