why is my code wrong ?

Please see the files attached and let me know what is wrong with this
l_dp =
0.7101 0 0 0.0447 0.7701 0 0.0379 0.8407
0 0 0 1.5729 0.0635 0 0 0.5264
1.1636 0.4907 0 0 0.2497 0 1.0603 0
0 0 1.1273 0 0.1478 0 0 1.4100
and this not right since demand on a path should total to one ie the sum of each row should be 1
whats wrong with my code is it ub limit or what ?
Please do help

2 Kommentare

Geoff Hayes
Geoff Hayes am 19 Okt. 2014
Bhavz - where in your code do you force that condition (that each row should sum to one) to be true? Or where do you expect that to be enforced (and why)?
Bhavz
Bhavz am 19 Okt. 2014
Bearbeitet: Bhavz am 28 Apr. 2015
^ its not about enforcing the condition but shudnt the demand on a path total to one technically ... thats what the correct functioning wud be ? I am attaching the equation i want to implement constraint wise ,u can see if i have made a mistake there What I have done is taken the network optimization from paper 2 in the network from 1 and I am trying to measure the effect on link utilization. How would you change the given Algorithm to route unsplittable flows on the specified single primary path only
And as always thankyou so much for yr help

Antworten (1)

Matt J
Matt J am 19 Okt. 2014
Bearbeitet: Matt J am 19 Okt. 2014

0 Stimmen

ie the sum of each row should be 1
If the unknown vector x is supposed to satisfy this, then presumably you need to have linear equality constraints,
Aeq=kron(ones(1,8),eye(4));
beq=[1;1;1;1]
[x,fval,exitflag] = ga(@objectiveFun,...
32,[],[],Aeq,beq,lb,[],nonlcon,options);

6 Kommentare

Bhavz
Bhavz am 19 Okt. 2014
Bearbeitet: Bhavz am 19 Okt. 2014
Many Thanks for yr answer the equations I am trying to implement is this one attached
Matt J
Matt J am 19 Okt. 2014
You're welcome.
Bhavz
Bhavz am 19 Okt. 2014
^ Do you find anything wrong in my implementation given the equationsof constraints I am trying to implement
Matt J
Matt J am 19 Okt. 2014
Bearbeitet: Matt J am 19 Okt. 2014
The constraints in formulas.bmp are linear inequality constraints A*x(:)<=b, which are specified in the 3rd and 4th argument to ga().
x = ga(fitnessfcn,nvars,A,b)
But it doesn't look like you've passed to any A, b data to ga.
Bhavz
Bhavz am 19 Okt. 2014
Bearbeitet: Bhavz am 19 Okt. 2014
Oh How would I do that as in pass values from constraints.m to
[x,fval,exitflag] = ga(@objectiveFun,...
32,[],[],Aeq,beq,lb,[],nonlcon,options);
Matt J
Matt J am 19 Okt. 2014
Bearbeitet: Matt J am 19 Okt. 2014
You would not use the nonlinear constraint function to handle linear constraints. You would generate appropriate A, b matrices, similar to what I did for you with Aeq and beq.

Diese Frage ist geschlossen.

Gefragt:

am 19 Okt. 2014

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by