Error using "mskoptimset"

8 vues (au cours des 30 derniers jours)
MohammadReza Jabbari (Jabari)
Commenté : C Euler le 26 Sep 2025
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);
  8 commentaires
Walter Roberson
Walter Roberson le 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.
C Euler
C Euler le 26 Sep 2025
your solution is a shit!!!!! I run the command, and every intalled toolbox fails, I need to add all their path one by one! such an idiot

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Surrogate Optimization dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by