Optimization problem with Mosek
Show older comments
I want to solve the following problem: Maximize \sum_{i=1}^{n} \log(v_i) subject to v_i \geq 0 and A' v \leq n 1_m, where A is a n \times m matrix of positive reals, using Mosek in Matlab. This is my code:
n = 10; % Number of variables
m = 20; % Number of constraints
F = rand(n, m)*100; % Example n x m matrix of positive reals
A = F'; % Transpose of F for the constraint matrix
b = n * ones(m, 1); % Right-hand side for constraints
% Optimization problem
prob.c = -ones(n, 1); % Coefficients for the objective function (maximize sum log(v_i))
prob.a = sparse(A); % Constraint matrix A'
prob.blc = -inf(m, 1); % Lower bounds
prob.buc = b; % Upper bounds
% Lower bounds (v >= 0)
prob.blx = zeros(n, 1); % Lower bounds for v
prob.bux = inf(n, 1); % No upper bounds for v
% Exponential cone constraints for log(v_i)
prob.cones.type = 'pexp'; % Type of cone (primal exponential)
prob.cones.sub = (1:n); % Indices of the variables involved in the cone
prob.cones.dim = repmat(3, n, 1); % Each cone has dimensionality 3
% Call MOSEK optimizer to solve the problem
[r, res] = mosekopt('minimize', prob);
I tried a few variants, but so far I always get error 1200. Any help?
Accepted Answer
More Answers (0)
Categories
Find more on Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!