Effacer les filtres
Effacer les filtres

Optimization problem with Mosek

49 vues (au cours des 30 derniers jours)
valentino dardanoni
valentino dardanoni le 20 Sep 2024 à 12:50
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?

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by