필터 지우기
필터 지우기

How can i implement a second decision variable which is not in the objective function?

조회 수: 2 (최근 30일)
hello everyone,
I am working on an optimization problem where i have 2 decision variable. One of the variable is xij, which is directly in the objective function, other one is yj, which is not in the objective function, it is in my constraints. yj is dependent to xij.
xij is an binary variable where i want solver to decide if xij is 1 or 0, and yj is the row summation of xij. here is an example;
lets say that the solver gave me a solution for xij like this;
x = [ 1 0 1 1; 0 0 1 0; 1 1 0 0]
i want yj to be column or a row vector it does not matter (preferably column)
yj = [ (1 +0 +1=) 2 ; (0 + 0+ 1=) 1; (1+1+0=)2 ; (1+0+0=)1]
I have other constraints where i use yj.
here is my model; (p=67) (M is some large number like 1000)
My first question is that; can i do this kind of an operation?
second Q : how can i do this?
Ps: I am using genetic algorithm solver!
thak you in advance!
Best,
Beyza.
  댓글 수: 9
Azime Beyza Ari
Azime Beyza Ari 2022년 3월 28일
I understood what you are saying. Thank you this is the answer.
i do not have equality constraints so Aeq and Beq will be empty. However, A and b, will be very big matrix and vector.
A will have an dimension of approxiametly 125x1332, so this is very unlogical to write manuelly. I will try to write them with a for loop if i can.
Again thank you!
Torsten
Torsten 2022년 3월 28일
편집: Torsten 2022년 3월 28일
My pleasure.
And use "intlinprog" instead of "ga" if the problem remains unchanged.
Setting up the matrix A and the vector b is the same for both solvers.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by