2018年10月6日星期六

python库picos使用问题

In the installation and use of 'picos' to solve optimization prob, I had some troubles, and listed them here.

system: windows 10
python 3.6

  • Problem: 
  • When 'import picos' 'import cvxopt', there is error "import cvxopt.base: the specified module could not be found".
  • Solution: 
  • Package CVXOPT requires numpy+mkl, we need to uninstall the numpy package and reinstall numpy+mkl from :

       http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

  • Problem:
  • When use 'cplex' solver for MIQP model in picos, it throws error 5002: problem is non-convex. 
  • model likes: (x-x_r)'Q(x-x_r), where x is variable and x_r is constant.  
  • Solution:
  • Error caused because I set x_r=prob.add_variable('x_r',x_r), and give it values later by x_r.value=cvxopt.matrix(A). Instead I have to change x_r to parameter by x_r=prob.new_param(cvxopt.matrix(A)) . However, in constraints, a constant can be set as variable.


在安装和使用'picos'来解决优化问题时,我遇到了一些麻烦,并将它们列在这里。

系统:windows 10
python 3.6

问题:
当'import picos''import cvxopt'时,出现错误“import cvxopt.base:找不到指定的模块”。
解:
包CVXOPT需要numpy + mkl,我们需要卸载numpy包并从以下位置重新安装numpy + mkl:


问题:
当在picos中使用'cplex'求解器用于MIQP模型时,它会抛出错误5002:问题是非凸的。
模型像这样:(x-x_r)'Q(x-x_r),其中x是变量,x_r是常量。
解:
错误是因为我设置 x_r为变量:  x_r = prob.add_variable('x_r',x_r),而后赋值x_r.value = cvxopt.matrix(A)给它。 
事实上,我必须通过 x_r =prob.new_param(cvxopt.matrix(A))将x_r更改为参数。
约束中的常量却可以设为variable。

没有评论:

发表评论

Root Me challenge: Bash-System 1

挑战链接: https://www.root-me.org/fr/Challenges/App-Script/ELF32-System-1 根据题意,我们的目标是查看 /challenge/app-script/ch11/.passwd 中的密码。 在ssh连接...