我正在使用工具ncpol2sdpa进行半定程序(SDP)。我尝试了链接中提到的几个例子,但是由于最后一个命令solve_sdp(sdpRelaxation)
,所有的例子都给出了相同的错误,我假设这个命令对相关的约束运行SDP优化。我得到的错误是
Calculating block structure...
Estimated number of SDP variables: 15
Generating moment matrix...
Reduced number of SDP variables: 11 (done: 93%)
Processing 8/10 constraints...
Traceback (most recent call last):
File "test2.py", line 56, in <module>
print(solve_sdp(sdpRelaxation))
File "/Library/Python/2.7/site-packages/ncpol2sdpa/solver_common.py", line 29, in solve_sdp
return solve_with_sdpa(sdpRelaxation, solverparameters)
File "/Library/Python/2.7/site-packages/ncpol2sdpa/sdpa_utils.py", line 100, in solve_with_sdpa
call([solverexecutable, tmp_dats_filename, tmp_out_filename])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
我可以看到这个工具做了一些计算,但后来给出了错误。我知道这是 工具特定的问题,但我可以看到程序正在试图读/写一个文件,如果我没有错的话,这个文件不存在。但我不知道到底是什么问题。如果能给我指点方向,看看到底是什么问题,我将不胜感激。在
如果您查看/System/Library/Frameworks的第1325-1326行/Python.framework/Versions/2.7/lib/Python2.7/子流程.py你会看到的
所以你好像在试图解压一个不存在的文件。如果这还不能为您解决问题,我建议您返回堆栈跟踪,查看引用的行,直到找到问题的根源。在
错误发生在文件sdpa中_实用工具.py在第100行,in:
call([solverexecutable, tmp_dats_filename, tmp_out_filename]
文件名好像有问题。在
要进行检查,请在该行之前插入:
print solverexecutable, tmp_dats_filename, tmp_out_filename
您应该在输出中看到相应的文件名,然后检查是否可以在系统中创建/读取这些文件。在
相关问题 更多 >
编程相关推荐