% Define decision variables
t1 = sdpvar(1,1); % Subscript[t,1]
e1 = sdpvar(1,1); % Subscript[e,1]
s1 = sdpvar(1,1); % Subscript[s,1]
y1 = binvar(1,1); % Subscript[y,1] - binary variable (0 or 1)
f1 = sdpvar(1,1); % Subscript[f,1]
% Define the objective function
objective = e1 + t1;
% Define constraints
constraints = [];
% Non-negativity constraints
constraints = [constraints, t1 >= 0];
constraints = [constraints, e1 >= 0];
constraints = [constraints, s1 >= 0];
% Bounds on f1
constraints = [constraints, f1 >= 0];
constraints = [constraints, f1 <= 12];
% Nonlinear constraints
% t1 >= s1 + 100/(f1*y1 + 1/100) - 1
constraints = [constraints, t1 >= s1 + 100/(f1*y1 + 1/100) - 1];
% e1 >= 1 - (s1 + 100/(f1*y1 + 1/100))
constraints = [constraints, e1 >= 1 - (s1 + 100/(f1*y1 + 1/100))];
% Set solver options for BARON
options = sdpsettings('solver', 'baron', 'verbose', 1);
% Solve the optimization problem
sol = optimize(constraints, objective, options);
% Check solution status
if sol.problem == 0
fprintf('Solution found successfully!\n');
fprintf('Optimal objective value: %.6f\n', value(objective));
fprintf('Optimal values:\n');
fprintf('t1 = %.6f\n', value(t1));
fprintf('e1 = %.6f\n', value(e1));
fprintf('s1 = %.6f\n', value(s1));
fprintf('y1 = %.6f\n', value(y1));
fprintf('f1 = %.6f\n', value(f1));
else
fprintf('Optimization failed with error code: %d\n', sol.problem);
fprintf('Error message: %s\n', sol.info); end
My output is very strange
Preprocessing found feasible solution with value 9999.00
Doing local search
Solving bounding LP
Starting multi-start local search
Preprocessing found feasible solution with value 7.32639
Problem solved during preprocessing
Lower bound is 7.32639
*** Normal completion ***
Wall clock time: 0.05
Total CPU time used: 0.02
Total no. of BaR iterations: -1
Best solution found at node: -1
Max. no. of nodes in memory: 0
All done
===========================================================================
Solution found successfully!
Optimal objective value: 0.000000
Optimal values:
t1 = 0.000000
e1 = 0.000000
s1 = 0.000000
y1 = 0.000000
f1 = 0.000000
Here, all of the objective value and corresponding decision variable seems to be wrong. I will attatch the BARON log file as
.
At this point I am not really sure if this is a BARON issue or YALMIP issue. It seems to me that BARON can find the correct solution but when YALMIP read it out. Things just gone awry.
Would you kindly help me with this.