Skip to content

Julia interface to SNOPT (must obtain a licensed copy of SNOPT separately)

License

Notifications You must be signed in to change notification settings

MatthewStuber/Snopt.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snopt.jl

Julia interface to SNOPT (must obtain a licensed copy of SNOPT separately).

To Install

  1. Clone the repo:
Pkg.clone(...)
  1. Copy your SNOPT source files into ~/.julia/v.../Snopt/deps/src (or wherever you cloned the repo to).

  2. You will need to make a couple of changes to subroutine sn02lib.f. Function snSet, snSeti, and snSetr require the following changes:

    character*(*) buffer => character buffer*72 (snSet)

    character*(*) buffer => character buffer*55 (snSeti and snSetr)

    lenbuf = len(buffer) => lenbuf = len_trim(buffer) (snSeti and snSetr)

    The first two change the argument from a variable length string to one with a known length (which are the max lengths according to snopt docs). I had problems trying to pass variable length strings from Julia. I believe this can be done with pointers and allocatable strings, but that requires changes on the Fortran side anyway (and the changes would be more extensive). You must then always pass in a string of the correct length from Julia, so I pad the options with spaces in Julia, but this is transparent to the user. The latter change computes the length without the whitespace at the end so that the messages printed in the files don't contain the extra padding.

  3. sn27lu.f, sn27lu77.f, and sn27lu90.f contain duplicate symbols. You'll need to keep only one file. I deleted the latter two files.

  4. Compile the fortran code.

Pkg.build("Snopt")

Run tests

Pkg.test("Snopt")

To Use

using Snopt

See examples in tests.

About

Julia interface to SNOPT (must obtain a licensed copy of SNOPT separately)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%