필터 지우기
필터 지우기

Issue using fgoalattain. How do i fix?

조회 수: 3 (최근 30일)
userpv
userpv 2022년 11월 18일
답변: Ishu 2023년 9월 1일
I'm getting the below issue. I'm not sure how to correct. It doesn't seem to make it past the initial values given.:
options =
struct with fields:
MaxFunctionEvaluations: 1.0000e+11
Local minimum possible. Constraints satisfied.
fgoalattain stopped because the size of the current search direction is less than
twice the value of the step size tolerance and constraints are
satisfied to within the value of the constraint tolerance.
<stopping criteria details>
x =
1.0e+04 *
Columns 1 through 9
0.0129 0.0065 0.0123 0.0094 0 0.0085 0.0099 0.0112 0.0119
Columns 10 through 13
0.0050 0.0088 0.0080 2.3998
Code:
clc
clear all
fun = @(x)[x(2)+x(6)+x(10);x(12);x(1)+x(5)+x(9);x(2)+x(6)+x(10);x(3)+x(7)+x(11);x(4)+x(8)+x(12);x(13);x(5)];
goal = [250,80,416,200,320,304,24750,0];
weight = [36,18,6,6,6,6,3,1];
A = [1,1,1,1,0,0,0,0,0,0,0,0,0
0,0,0,0,1,1,1,1,0,0,0,0,0
0,0,0,0,0,0,0,0,1,1,1,1,0
1,0,0,0,1,0,0,0,1,0,0,0,0
0,1,0,0,0,1,0,0,0,1,0,0,0
0,0,1,0,0,0,1,0,0,0,1,0,0
0,0,0,1,0,0,0,1,0,0,0,1,0];
b= [420
610
340
520
250
400
380];
Aeq=[22,17,30,18,15,35,20,25,28,21,16,14,-1];
beq=[0];
lb = [0,0,0,0,0,0,0,0,0,0,0,0,0];
ub = [];
nonlcon=[];
options = struct('MaxFunctionEvaluations',10e+10)
x0=[75,75,50,50,50,50,50,50,50,50,50,50,24000];
x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
  댓글 수: 1
userpv
userpv 2022년 11월 18일
Since the output doesn't make it past the initial variables, none of the goal functions are acheived

댓글을 달려면 로그인하십시오.

답변 (1개)

Ishu
Ishu 2023년 9월 1일
Hi userpv,
I am assuming that the error you are referring to is the one that you have pasted above your code.
Actually that is not an error, that is the output of the "fgoalattain" function.
When performing optimization, the search direction represents the change in the variables at each iteration of the optimization algorithm. The step size tolerance is a user-defined parameter that determines the minimum acceptable step size for convergence. If the size of the search direction becomes smaller than twice the step size tolerance, it suggests that the algorithm has made very small or negligible progress towards the optimal solution. Hence the function stops.
To define the step size tolerance in "fgoalattain" you can set the 'OptimalityTolerance' option to a desired value.
options = optimoptions('fgoalattain', 'OptimalityTolerance', 1e-8);
For more information on "fgoalattain" you can refer this documentation:
Hope it helps!

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by