Error using "mskoptimset"
28 views (last 30 days)
Show older comments
Hi. I want to use "surrogateopt" or "ga" to solve mixed-integer programming. But I got this error for both solvers. If someone could help me, I would greatly appreciate it.
"Error using mskoptimset
Expected argument 2 to be a string parameter name or an options structure
created with mskoptimset.
Error in linprog (line 138)"
My code is as follows:
Objconstr = @(phi) DL_Sum_Throughput (phi, P_DL_b_m, h_b_m, sigma2, K);
A_Eq1 = kron( ones(1,B) , eye(M) ); % Dim: M x BM
A_Eq2 = kron( ones(1,K) , eye(M) ); % Dim: M x KM
A_Eq3 = zeros(1,K); % Dim: 1 x K
A_Eq = blkdiag( A_Eq1 , A_Eq2, A_Eq3 ); % Dim: 2M+1 x M(B+K)
b_Eq = [ones(2*M,1) ; 0]; % Dim: 2M+1 x 1
A_InEq1 = kron( eye(B) , ones(1,M) ); % Dim: B x BM
A_InEq2 = 2 - kron( eye(K) , ones(1,M) ); % Dim: K x KM
A_InEq3 = zeros(1,K); % Dim: 1 x K
b_InEq1 = round(P_DL_b'./sum(P_DL_b) *M); % Dim: B x 1
b_InEq2 = zeros(K,1); % Dim: K x 1
A_InEq = blkdiag(A_InEq1 , A_InEq2, A_InEq3); % Dim: B+K+1 x M(B+K)
b_InEq = [b_InEq1 ; b_InEq2; 0]; % Dim: B+K+1 x 1
intcon = 1:1:M*(B+K); % Decision Variables that are integer-valued
lb = zeros(1,M*(B+K)+K);
ub = [ones(1,M*(B+K)) , ones(1,K)*W_Total];
% ub = [ones(1,M*(B+K) + K)];
%% Mixed Integer Surrogate Optimization
options_surr = optimoptions('surrogateopt','PlotFcn','surrogateoptplot','ConstraintTolerance',1e-6,...
'MaxFunctionEvaluations',200);
problem_surr = struct('objective',Objconstr,'lb',lb,'ub',ub,'intcon',intcon,...
'Aineq',A_InEq,'bineq',b_InEq,'Aeq',A_Eq,'beq',b_Eq,'options',options_surr,'solver','surrogateopt');
[x_surr, fval_surr, exitflag_surr, output_surr, trials_surr] = surrogateopt(problem_surr);
7 Comments
Walter Roberson
on 3 Mar 2023
You do not call the Mosek solver in your code.
If the Mosek solver is interfering, then the problem is something in the Mosek solver, such as if the solver provides its own linprog() that is being called instead of MATLAB's.
Experiment with
restoredefaultpath; rehash toolboxcache
and see if the code starts working (or at least not giving the mosek error.) If it does then use tests such as
which -all linprog
or use the debugger to figure out where a non-mathworks function is being called.
Answers (0)
See Also
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming 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!