Hello, I'd like to solve the problem during the optimization using matlab and aspen hysys.
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello, Whom.
I'm currently trying to optimize the simple compressor stage with the code as below.
The function is sum of the energy of the compressors and the variables are the pressures of the output
Objective = @(x) MyK1.EnergyValue + MyK2.EnergyValue + MyK3.EnergyValue;
global x;
x = 1:2;
MyM1.PressureValue = x(1);
MyM2.PressureValue = x(2);
if MyM2.TemperatureValue < 30
MyM3.TemperatureValue = MyM2.TemperatureValue;
else
MyM3.TemperatureValue = 30;
end
lb = [107, 107];
ub = [4000, 4000];
A = [];
b = [];
Aeq = [];
beq = [];
x0 = [300, 1200];
disp(['Initial objective:' num2str(Objective(x))])
nonlincon = @TestCons;
opts = optimoptions(@fmincon,'Display','iter','Algorithm','sqp','FiniteDifferenceStepSize', 5);
problem = createOptimProblem('fmincon','objective',Objective,'x0',x0,'lb',lb,'ub',ub,'nonlcon',nonlincon,'options',opts);
gs = GlobalSearch('FunctionTolerance', 2e-4,'NumTrialPoints',2000)
ms = MultiStart(gs);
[x,f] = run(ms,problem,20)
disp(x)
disp(['Final objective:' num2str(Objective(x))])
But there's only one iteration and show the context:
Iter Func-count Fval Feasibility Step Length Norm of First-order
step optimality
0 3 -3.329715e+02 3.991e+00 1.000e+00 0.000e+00 0.000e+00
1 4 -3.329715e+02 3.991e+00 7.000e-01 8.011e-17 0.000e+00
Converged to an infeasible point.
fmincon stopped because the size of the current step is less than
the value of the step size tolerance but constraints are not
satisfied to within the value of the constraint tolerance.
<stopping criteria details>
No feasible solution found.
MultiStart called the local solver 20 times and did not find a point that satisfies the constraints
within the local solver constraint tolerance (problem.options.ConstraintTolerance).
x =
300 1200
f =
-332.9715
300 1200
Final objective:-332.9715
So I've tried to change the stepsize artificially but not working.
What should I do with it?
Can somebody help me please?
댓글 수: 2
rubindan
2020년 7월 8일
It seems like your initial guess violates the nonlinear constraints.
It also seems that your cost function does not depend on x
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!