http://www.psopt.org/ 与 https://github.com/PSOPT/psopt 网址安装psopt
在ubuntu下安装容易些, 使用其自带的install-ubuntu-16.04.sh即可,注意问题:
命令cd $HOME/Downloads会存在问题
$HOME表示/home的路径,但是有的系统可能无法识别这个命名,可以直接指定,比如换为/home/admin
Downloads这个路径也会存在问题,中文的ubuntu系统,会无法识别这个路径,可以将Downloads改为Download,
在/home/admin/Download,这样尽量避免系统无法识别命令的情况
安装成功的标志是,使用install-ubuntu.sh安装结束后,会出现几个图;并且PSOPT/examples/launch在这个路径中,有.exe文件,安装成功,例程example中会有exe文件;
安装结束后,如过出现/usr/bin/ld: 找不到 -lapack; /usr/bin/ld: 找不到 -lopenblas,需要检查,sudo apt-get -y install g++ gfortran f2c libf2c2-dev libf2c2 libblas-dev libopenblas-base libopenblas-dev libblas3 libatlas-base-dev liblapack-dev liblapack3 这些库是否安装
通过命令dpkg -l |grep blas可以查看,|grep 字符串,会显示所有包含该字符串的安装库,如出现以下结果
ii libblas-common 3.6.0-2ubuntu2 amd64 Dependency package for all BLAS implementations
ii libblas-dev 3.6.0-2ubuntu2 amd64 Basic Linear Algebra Subroutines 3, static library
ii libblas3 3.6.0-2ubuntu2 amd64 Basic Linear Algebra Reference implementations, shared library
ii libopenblas-base 0.2.18-1ubuntu1 amd64 Optimized BLAS (linear algebra) library (shared library)
ii libopenblas-dev 0.2.18-1ubuntu1 amd64 Optimized BLAS (linear algebra) library (development files)
如果找不到库,说明没有安装好库;需要sudo apt-get update更新;
安装成功后,跑以下命令;可以出现以下类似结果,并有图;
zengyuhang@zengyuhang-X556UQK:~$ cd /home/zengyuhang/psopt-master/PSOPT/examples/launch
zengyuhang@zengyuhang-X556UQK:~/psopt-master/PSOPT/examples/launch$ ./launch
*******************************************************************************
* This is PSOPT, an optimal control solver based on pseudospectral and local *
* collocation methods, together with large scale nonlinear programming *
* Copyright (C) 2010 Victor M. Becerra. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; version 2.1. *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; *
* If not please visit http://www.gnu.org/licenses *
* *
* The author can be contacted at his email address: v.m.becerra@ieee.org *
* *
*******************************************************************************
Problem: Multiphase vehicle launch
This is mesh refinement iteration: 1
Collocation method: Legendre
Differentiation matrix: standard
Number of NLP variables 208
Number of NLP nonlinear constraints: 200
Number of nodes phase 1: 5
Number of nodes phase 2: 5
Number of nodes phase 3: 5
Number of nodes phase 4: 5