s = sdpvar(n,1)
objective=c'*s + s'*Y*kron(s,s);
constraints = ...
optimize(constraints,-objective,sdpsettings('solver','up to you'))
sdisplay(w{1}'*Q{1}*w{1})
0.322343930628*s(1)^4+1.71525107762*s(1)^3*s(2)+3.41581827041*s(1)^2*s(2)^2+2.07266418966*s(1)*s(2)^3+0.677557960459*s(2)^4
Initially 6 monomials in R^2Newton polytope (0 LPs).........Keeping 3 monomials (0.015625sec)Finding symmetries..............Found 1 symmetry (0sec)Partitioning using symmetry.....3x3(1)
-------------------------------------------------------------------------
YALMIP SOS module started...
-------------------------------------------------------------------------
Detected 0 parametric variables and 2 independent variables.
Detected 0 linear inequalities, 0 equality constraints and 0 LMIs.
Using kernel representation (options.sos.model=1).
Initially 6 monomials in R^2
Newton polytope (0 LPs).........Keeping 3 monomials (0.015625sec)
Finding symmetries..............Found 1 symmetry (0.03125sec)
Partitioning using symmetry.....3x3(1)
>> sol
sol =
struct with fields:
solvertime: 0
info: 'No suitable solver'
problem: -2
yalmiptime: 2.8620
>> sdisplay(w{1}'*Q{1}*w{1})
Brace indexing is not supported for variables of this type.
MATLAB Version: 9.6.0.1114505 (R2019a) Update 2
Version 25-April-2019
M = 100;
Y = rand(M,M^2);
s = sdpvar(M,1);
objective = s'*Y*kron(s,s);
Constraints = [-0.5 <= s <= 0.5];
tic; sol = optimize(Constraints,-objective,sdpsettings('solver','bmibnb','verbose',1)); toc
solution = value(s)
Operation terminated by user during update_monomial_bounds (line 28)
In bmibnb (line 129)
p = update_monomial_bounds(p);
In solvesdp (line 364)
eval(['output = ' solver.call '(interfacedata);']);
In optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});
sol =
struct with fields:
yalmipversion: '20190425' yalmiptime: NaN solvertime: NaN info: 'Unknown problem in solver (Turn on 'debug' in sdpsettings) (Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.)' problem: 9
sol =
struct with fields:
yalmipversion: '20190425'
yalmiptime: 1.2923
solvertime: 4.5957
info: 'Successfully solved (IPOPT)'
problem: 0
clear all; clc; close all;
M = 20;
Y = rand(M,M^2);
s = sdpvar(M,1);
objective = s
'*Y*kron(s,s);
Constraints = [-0.05 <= sum(s) <= 0.05, ...
-0.01 <= s <= 0.01];
tic; sol = optimize(Constraints,-objective,sdpsettings('solver','bmibnb','verbose',1,'debug',1)); toc
solution = value(s)
sol
* Starting YALMIP global branch & bound.
* Branch-variables : 20
* Upper solver : fmincon
* Lower solver : SCIP
* LP solver : SCIP
Node Upper Gap(%) Lower Open
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of
rows in the second matrix. To perform elementwise multiplication, use '.*'.
Error in solvelower (line 158)
cost = output.Primal'*p_cut.Q*output.Primal + p_cut.c'*output.Primal + p.f;
Error in branch_and_bound (line 133)
[output,cost,p,timing] = solvelower(p,options,lowersolver,x_min,upper,timing);
Error in bmibnb (line 364)
[x_min,solved_nodes,lower,upper,lower_hist,upper_hist,timing,counter,problem] = branch_and_bound(p,x_min,upper,timing);
Error in solvesdp (line 361)
eval(['output = ' solver.call '(interfacedata);']);
Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************
Total number of variables............................: 20
variables with only lower bounds: 0
variables with lower and upper bounds: 20
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 2
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 2
Number of Iterations....: 4
(scaled) (unscaled)
Objective...............: 6.9932414955296644e-54 6.9932414955296644e-54
Dual infeasibility......: 2.3822801641527197e-22 2.3822801641527197e-22
Constraint violation....: 0.0000000000000000e+00 0.0000000000000000e+00
Complementarity.........: 9.0909090909091520e-09 9.0909090909091520e-09
Overall NLP error.......: 9.0909090909091520e-09 9.0909090909091520e-09
Number of objective function evaluations = 5
Number of objective gradient evaluations = 5
Number of equality constraint evaluations = 0
Number of inequality constraint evaluations = 5
Number of equality constraint Jacobian evaluations = 0
Number of inequality constraint Jacobian evaluations = 5
Number of Lagrangian Hessian evaluations = 0
Total CPU secs in IPOPT (w/o function evaluations) = 0.161
Total CPU secs in NLP function evaluations = 0.177
EXIT: Optimal Solution Found.
Elapsed time is 4.440863 seconds.
solution =
1.0e-18 *
-0.6847
-0.6847
0.0174
0.0174
0.0174
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
-0.0730
sol =
struct with fields:
yalmipversion: '20190425'
yalmiptime: 1.0451
solvertime: 1.6549
info: 'Successfully solved (IPOPT)'
problem: 0
------------------------------------------------------------------
This is NOMAD v3.8.1
Authors: M. Abramson, C. Audet, G. Couture, J. Dennis, S. Le Digabel, C. Tribes
Problem Properties:
# Decision Variables: 50
# Number of Objectives: 1
# Number of Nonlinear Constraints: 2
------------------------------------------------------------------
1 0.0000000000
2 -0.0000008161
3 -0.0000043706
5 -0.0000119161
8 -0.0000322226
12 -0.0000609718
110 -0.0000614974
164 -0.0000704629
165 -0.0000932122
175 -0.0000975907
185 -0.0001033187
189 -0.0001098696
193 -0.0001153159
194 -0.0001248690
196 -0.0001563574
197 -0.0001783060
200 -0.0001871463
212 -0.0002110928
213 -0.0002139896
214 -0.0002307451
219 -0.0002314382
243 -0.0002774137
244 -0.0003114578
251 -0.0003169583
299 -0.0003170891
300 -0.0003174814
301 -0.0003190501
302 -0.0003251822
303 -0.0003377322
310 -0.0003486065
344 -0.0003721223
361 -0.0004023095
403 -0.0004442718
407 -0.0004577314
408 -0.0004620652
409 -0.0004768089
442 -0.0005069975
454 -0.0005451335
492 -0.0005624675
2000 -0.0005624675
2175 -0.0005624675
2210 -0.0005624675
2230 -0.0005624675
2288 -0.0005624675
------------------------------------------------------------------
Elapsed time is 14.069672 seconds.
solution =
-0.0100
0.0100
-0.0100
0.0100
-0.0100
-0.0100
0.0100
0.0100
-0.0100
0.0100
0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
-0.0100
-0.0100
-0.0100
-0.0100
-0.0100
0.0100
0.0100
-0.0100
-0.0100
-0.0100
-0.0100
0.0100
-0.0100
0.0100
0.0100
-0.0100
0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
-0.0100
0.0100
0.0100
sol =
struct with fields:
yalmipversion: '20190425'
yalmiptime: 1.1070
solvertime: 11.5050
info: 'Successfully solved (NOMAD)'
problem: 0
* Starting YALMIP global branch & bound.* Branch-variables : 20* Upper solver : fmincon
* Lower solver : GUROBI* LP solver : GUROBI
Node Upper Gap(%) Lower Open
1 : -7.135E-05 0.37 -3.813E-03 2 * Finished. Cost: -7.1354e-05 Gap: 0.37343* Termination with relative gap satisfied * Timing: 2% spent in upper solver (2 problems solved)* 1% spent in lower solver (41 problems solved)* 10% spent in LP-based domain reduction (40 problems solved)