Open HiroIshida opened 4 months ago
https://ccom.ucsd.edu/~optimizers/static/pdfs/sndoc7.pdf Start = 2にする. 与える変数はxと, xstate. xstateはupper bound lower boundがactiveがどうかを示す値だと思う.
If there is no wish to provide special information, you may set xstate(j) = 0,
と書いているので, とりあえず, 何もいれずにおく.
次のpatchをあてる. https://github.com/HiroIshida/ifopt/commit/532830ba60b20e76baae0a7fe66583f6cc15254f
exampleコードを二回目に解くときはsolutionを再利用するように変更すると, iterationが3から1に減ったのでこれでよさそう.
Problem name snopt
No. of iterations 3 Objective -4.0000000000E+00
No. of major iterations 3 Linear obj. term 0.0000000000E+00
Penalty parameter -1.111E+04 Nonlinear obj. term -4.0000000000E+00
User function calls (total) 8
No. of degenerate steps 0 Percentage 0.00
Max x 1 1.0E+00 Max pi 1 4.0E+00
Max Primal infeas 0 0.0E+00 Max Dual infeas 0 0.0E+00
Nonlinear constraint violn 0.0E+00
No. of iterations 1 Objective -4.0000000000E+00
No. of major iterations 0 Linear obj. term 0.0000000000E+00
Penalty parameter -1.111E+04 Nonlinear obj. term -4.0000000000E+00
User function calls (total) 4
No. of degenerate steps 1 Percentage 100.00
Max x 1 1.0E+00 Max pi 1 4.0E+00
Max Primal infeas 0 0.0E+00 Max Dual infeas 0 0.0E+00
Nonlinear constraint violn 0.0E+00
動機
ETH の https://github.com/ethz-adrl/towr を試したい. 内部ではhttps://github.com/ethz-adrl/ifoptを使っている. ifoptはipoptとsnoptのどちらかを使えるようになっている. open sourceのipoptがデフォルトになっている. しかし, ipoptは内点法ベースなのでwarm-startがやりにくい. なのでsnopt (sqp)でwarm-startを試したい. 著者もそういっている: https://github.com/ethz-adrl/ifopt/issues/67
入手方法/ビルド
ここに連絡して試供版をもらえる. 昔試供版をダウンロードしたことがあったのだが、もう一度試したいとかいて送ったらまた送ってもらえた.
https://ccom.ucsd.edu/~optimizers/downloads/request/ メールではライセンスファイル
snopt7.lic
が送られてくる. ソフト自体は https://ccom.ucsd.edu/~optimizers/downloads/software/academic/?id=0a6f613de5da からダウンロードする(一番下のc++ version).ライセンスファイルのありかは環境変数で指定する.
理由は不明 (もしかして古いsnoptバージョンを想定してる?)だが, snoptのためのcmakeは https://github.com/ethz-adrl/ifopt/blob/master/ifopt_snopt/cmake/FindSNOPT.cmake#L24 にあるように, lib, includeディレクトリがあることを想定している. しかし, downloadしてきたsnoptは次のようなフラットなディレクトリになっている.
このままではビルドできないので, 次のように整形する:
また, ifoptの説明書にあるように, 次のように環境変数をexport
あと, snopt version7以降だとそのままでは使えないので, いろいろソースコードを弄る必要がある: https://github.com/ethz-adrl/ifopt/issues/31 具体的には次のコミットのdiffを参照: https://github.com/HiroIshida/ifopt/commit/dad19fab675cf3c9764c369dbe6633de19e0b31b
これでビルドできる.