How to supress YALMIP output to matlab, and how to output a modle file

1,030 views
Skip to first unread message

Shuaian Wang

unread,
Nov 28, 2012, 6:14:40 PM11/28/12
to yal...@googlegroups.com

Question 1:
I use CPLEX in YALMIP (matlab), and set "verbose" to 0  as follows: 
 
options = sdpsettings('verbose',0,'solver','cplex');
solvesdp(Constraints, Objective, options);
 
However, I still get a lot of output in the command window of matlab (there is a line of message when a constraint is added, and in my model I need to add at least 100 000 constraints. In other words, I need to wait maybe 10 minutes for the output, and then the model can be solved). How can I have NO output on the screen?
 
Question 2:
I would like to check whether my model is wrong (due to programming typos), and hence I would like to output the model to a file:
 
options = sdpsettings('verbose',0,'solver','cplex');
model = 'model.lp';
recoverymodel = 'recoverymodel.lp';
[model, recoverymodel] = export(Constraints, Objective,options);
 
However, no file is generated using the above codes, and how should I get a file containing the model?
 
 

 

Shuaian Wang

unread,
Nov 28, 2012, 6:38:43 PM11/28/12
to yal...@googlegroups.com
The first question is solved.
It is because I changed the size of Constraints in a "for" loop. Now I use "for" loop to generate a coefficient matrix and the problem no longer exists.
The second question remains unsolved.

Shuaian Wang

unread,
Nov 28, 2012, 10:09:06 PM11/28/12
to yal...@googlegroups.com
The 2nd question is also kind of solved.
The following code could output a file of AMPL model:
 
saveampl(Constraints, Objective, 'mymodel.mod');

Johan Löfberg

unread,
Nov 29, 2012, 2:42:08 AM11/29/12
to yal...@googlegroups.com
To summarize

1. I guess you forgot to use a ; somewhere when creating your constraints, as YALMIP never prints anything.

2. export creates numerical matlab objects (and the whole syntax you used was very odd, since you first created strings and then you overwrote them with results from export). To generate cplex-readable text files use savecplex or perhaps saveampl


Shuaian Wang

unread,
Nov 29, 2012, 3:13:24 AM11/29/12
to yal...@googlegroups.com
Thank you!
Actually I started to use Yalmip today suggested by Yuquan Du.
It is indeed very convenient, and I am still in the process of learning.

NiuX-hnu

unread,
Dec 24, 2013, 4:53:00 AM12/24/13
to yal...@googlegroups.com
你好啊,你应该是中国人吧,我想请问下怎么用yalmip把模型导出到LP文件,因为我想根据LP文件用OPL语言写程序。谢谢!

Johan Löfberg

unread,
Dec 24, 2013, 4:58:56 AM12/24/13
to yal...@googlegroups.com
There is no way to convert to OPL format. The only possible outputs are ampl (saveampl) and cplexlp (savecplexlp), besides purely numerical formats used in the various solvers (using export). 
Reply all
Reply to author
Forward
0 new messages