How to formulate GA with plenty variables (e.g >24000 variables)

조회 수: 3 (최근 30일)
Charles Uko
Charles Uko 2020년 3월 30일
댓글: praveen kumar 2024년 1월 15일
Hi everyone.
Please what is the best way to formulate a GA using the GA toolbox in MATLAB. Most of the examples I have seen are limited to at most 10 variables that are collected in an array X.
In my problem, variables e.g ON status of a unit changes with respect to the time or period of 24 hours. Which means for every UNIT, it has 24 variables just indicating the ON status of the unit throughout the 24 hour period.
I have multiple units in my problem which means variables for ON status alone is already 24 * Number of Units (1000).
Please what is the best way to formulate this problem for solving using GA toolbox?
  댓글 수: 2
praveen kumar
praveen kumar 2020년 5월 24일
ga tool box cannot be used u can write your own code
praveen kumar
praveen kumar 2024년 1월 15일
Instead of using binary representation for unit commitment you can represent ON/OFF status as integer coded this reduces the memory required for ON/OFF status of Unit commitment..Here his the code for UC problem with 10 unit system 24 hrs sheduling period
clear all;
close all;
clc;
global data n h Pd Pmax CC CCC pop_size YY
pop_size=1;
n=10;
h=24;
cycles=5;
Penalty=100;
data=[455 150 1000 16.19 0.00048 8 8 4500 9000 5 8
455 150 970 17.26 0.00031 8 8 5000 10000 5 8
130 20 700 16.60 0.00200 5 5 550 1100 4 -5
130 20 680 16.50 0.00211 5 5 560 1120 4 -5
162 25 450 19.70 0.00398 6 6 900 1800 4 -6
80 20 370 22.26 0.00712 3 3 170 340 2 -3
85 25 480 27.74 0.00079 3 3 260 520 2 -3
55 10 660 25.92 0.00413 1 1 30 60 0 -1
55 10 665 27.27 0.00222 1 1 30 60 0 -1
55 10 670 27.79 0.00173 1 1 30 60 0 -1];
Pd=[700 750 850 950 1000 1100 1150 1200 1300 1400 1450 1500 1400 1300 1200 1050 1000 1100 1200 1400 1300 1100 900 800];
SR=0.1.*Pd;
Pmax=data(:,1);
Pmin=data(:,2);
a=data(:,3);
b=data(:,4);
c=data(:,5);
minup=data(:,6);
mindown=data(:,7);
hotstartcost=data(:,8);
coldstartcost=data(:,9);
coldstarthrs=data(:,10);
initialstatus=data(:,11);
CC=zeros(n,cycles,pop_size);
% base unit
for k=1:pop_size
for i=1:2
CC(i,1,k)=24;
end
end
%initialization on/off shedule based on load curve
for k=1:pop_size
for i=3:n
temp1=0;temp2=0;
for j=1:cycles
if(initialstatus(i)<0 && j==1 )
temp=max(0,(minup(i)+initialstatus(i)));
CC(i,j,k)=-round(unifrnd(temp,h));
end
if(initialstatus(i)>0 && j==1)
temp=max(0,(minup(i)-initialstatus(i)));
CC(i,j,k)=round(unifrnd(temp,h));
temp1=sum(abs(CC(i,j,k)));
temp2=h-temp1;
end
if(j>1&& CC(i,j-1,k)<0)
if(temp2>minup(i))
CC(i,j,k)=round(unifrnd(minup(i),temp2));
end
if(temp2<=minup(i))
CC(i,j,k)=temp2;
end
end
if(j>1&& CC(i,j-1,k)>0 )
if(temp2>minup(i))
CC(i,j,k)=-round(unifrnd(minup(i),temp2));
end
if(temp2<=minup(i))
CC(i,j,k)=-(temp2);
end
end
temp1=temp1+sum(abs(CC(i,j,k)));
temp2=h-temp1;
end
end
end
CC
CC = 10×5
24 0 0 0 0 24 0 0 0 0 -2 11 -5 6 0 -7 10 -7 0 0 -13 9 -2 0 0 -1 4 -8 4 -7 -20 4 0 0 0 -19 2 -2 1 0 0 0 0 0 0 0 0 0 0 0

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

답변 (1개)

Alan Weiss
Alan Weiss 2020년 5월 26일
It seems that you have thousands of binary variables. If so, then indeed ga is not an effective solver for your problem.
You would likely do better using intlinprog as a solver. You need to formulate your problem as mixed-integer linear programming, but, if you look at the examples, you will see that a wide variety of problems can be formulated that way.
Good luck,
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