필터 지우기
필터 지우기

How to input mixed positive integer variable to "gamultiobj" fitness function?

조회 수: 2 (최근 30일)
AKHILESH BARNWAL
AKHILESH BARNWAL 2022년 3월 27일
답변: Alan Weiss 2022년 3월 28일
Hello all, I am using the "gamultiobj" optimization function.
I have two variable(nvars=2) in my problem. That is each function takes the two variable x(1) and x(2). The problem solves well for contineuos variable lying between 2 to 10 and 1.5 to 5.
Now I want to modify the first variable as positive integer i.e. the first variable must be a positive integer number between 2 to 10 (1, 2, 3, 4,5, 6, 7, 8, 9 or 10 only) while the second one is a contineous. My problem is when I am setting lb=[2 1.5]; ub=[10 5]; the second variable is still continous number. So how can I fix the first variable to vary as integer number in between 2 to 5?
fn = @(x)[fn1(x),fn2(x),fn3(x),];
nvars=2;
A=[];
b=[];
Aeq = [];
beq = [];
lb=[2 1.5];
ub=[10 5];
rng default % for reproducibility
[x,fval] = gamultiobj(fn,nvar,A,b,Aeq,beq,lb,ub);
Thanks in advance

답변 (1개)

Alan Weiss
Alan Weiss 2022년 3월 28일
If your MATLAB version is R2021b or later, you can use integer constraints in gamultiobj. For details, see the function reference page.
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by