[37] | 1 | function output = callcsdp(interfacedata); |
---|
| 2 | |
---|
| 3 | % Retrieve needed data |
---|
| 4 | options = interfacedata.options; |
---|
| 5 | F_struc = interfacedata.F_struc; |
---|
| 6 | c = interfacedata.c; |
---|
| 7 | K = interfacedata.K; |
---|
| 8 | x0 = interfacedata.x0; |
---|
| 9 | pars = interfacedata.options.csdp; |
---|
| 10 | ub = interfacedata.ub; |
---|
| 11 | lb = interfacedata.lb; |
---|
| 12 | |
---|
| 13 | % Bounded variables converted to constraints |
---|
| 14 | if ~isempty(ub) |
---|
| 15 | [F_struc,K] = addbounds(F_struc,K,ub,lb); |
---|
| 16 | end |
---|
| 17 | |
---|
| 18 | pars.printlevel=options.verbose; |
---|
| 19 | |
---|
| 20 | if options.savedebug |
---|
| 21 | save csdpdebug F_struc c K pars |
---|
| 22 | end |
---|
| 23 | |
---|
| 24 | if options.showprogress;showprogress(['Calling ' interfacedata.solver.tag],options.showprogress);end |
---|
| 25 | solvertime = clock; |
---|
| 26 | [x_s,y_s,z_s,info]=csdp(-F_struc(:,2:end),-c,F_struc(:,1),K,pars); |
---|
| 27 | solvertime = etime(clock,solvertime); |
---|
| 28 | |
---|
| 29 | % We solve dual problem with CSDP |
---|
| 30 | Dual = x_s; |
---|
| 31 | x = y_s; |
---|
| 32 | |
---|
| 33 | switch info |
---|
| 34 | case 0 |
---|
| 35 | problem = 0; |
---|
| 36 | case 1 |
---|
| 37 | problem = 2; |
---|
| 38 | case 2 |
---|
| 39 | problem = 1; |
---|
| 40 | case {3,5,6,7,8,9} |
---|
| 41 | problem = 4; |
---|
| 42 | case 4 |
---|
| 43 | problem = 3; |
---|
| 44 | otherwise |
---|
| 45 | problem = 9; |
---|
| 46 | end |
---|
| 47 | infostr = yalmiperror(problem,interfacedata.solver.tag); |
---|
| 48 | |
---|
| 49 | % Save ALL data sent to solver |
---|
| 50 | if options.savesolverinput |
---|
| 51 | solverinput.A = -F_struc(:,2:end); |
---|
| 52 | solverinput.c = F_struc(:,1); |
---|
| 53 | solverinput.b = -c; |
---|
| 54 | solverinput.K = K; |
---|
| 55 | solverinput.pars = pars; |
---|
| 56 | else |
---|
| 57 | solverinput = []; |
---|
| 58 | end |
---|
| 59 | |
---|
| 60 | % Save ALL data from the solution? |
---|
| 61 | if options.savesolveroutput |
---|
| 62 | solveroutput.x = x_s; |
---|
| 63 | solveroutput.y = y_s; |
---|
| 64 | solveroutput.info = info; |
---|
| 65 | else |
---|
| 66 | solveroutput = []; |
---|
| 67 | end |
---|
| 68 | |
---|
| 69 | % Standard interface |
---|
| 70 | output.Primal = x; |
---|
| 71 | output.Dual = Dual; |
---|
| 72 | output.Slack = z_s; |
---|
| 73 | output.problem = problem; |
---|
| 74 | output.infostr = infostr; |
---|
| 75 | output.solverinput = solverinput; |
---|
| 76 | output.solveroutput= solveroutput; |
---|
| 77 | output.solvertime = solvertime; |
---|