Thread Subject:
Implicit function within linprog for loop

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 6 Jul, 2012 18:21:35

Message: 1 of 36

Hi I have the following code

    
Diesel_cost_per_kWh = 0.4;
a = 0.0082;
b = 0.023;
c = 0.253

for j = 1:24
    
    
    diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c
    
    
    Diesel_cost(j) = diesel_power_out(j,i)*Diesel_cost_per_kWh
    
    
    A(j,:) = [-PV_supply(j,:) -WT_supply(j,:) -diesel_power_out(j,:)];
    
    b(j) = -Demand(j);
    
    
    f(:,j) = [CRF_PV*CC_PV/8760;CRF_WT*CC_WT/8760;CRF_Diesel_generator*CC_Diesel+Diesel_cost(j)/8760];
    
    
    [x(j,:),fval(:,j),exitflag(:,j)] = linprog(f(:,j),A(j,:),b(j))

end

Where PV_supply and WT_supply are 24x1 vectors with known values of each element.
What I am trying to do is find the "optimum" x1, x2 and x3 value per hour for this data set and my objective function is a minimum cost function.

However, as you can see the "diesel_power_out" is some sort of implicit function which I am trying to solve simultaneously with linprog.
Therefore I am trying to find the optimum "diesel_power_out" value for each of the 24 hours that meets the objective and criteria from the expression shown above as

    diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c

I am not really sure where to start, and was hoping for advice on this and if such a task is even possible.
Do I need some sort of iteration that is taking place within the linprog for loop?

Hope my question is clear, please let me know if more info/explanation is needed?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 6 Jul, 2012 22:07:07

Message: 2 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <da577c84-19fa-48dc-9fc7-2c8c3ec845c0@googlegroups.com>...
> Hi I have the following code
>
>
> Diesel_cost_per_kWh = 0.4;
> a = 0.0082;
> b = 0.023;
> c = 0.253
>
> for j = 1:24
>
>
> diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c
>
>
> Diesel_cost(j) = diesel_power_out(j,i)*Diesel_cost_per_kWh
>
>
> A(j,:) = [-PV_supply(j,:) -WT_supply(j,:) -diesel_power_out(j,:)];
>
> b(j) = -Demand(j);
>
>
> f(:,j) = [CRF_PV*CC_PV/8760;CRF_WT*CC_WT/8760;CRF_Diesel_generator*CC_Diesel+Diesel_cost(j)/8760];
>
>
> [x(j,:),fval(:,j),exitflag(:,j)] = linprog(f(:,j),A(j,:),b(j))
>
> end
>
> Where PV_supply and WT_supply are 24x1 vectors with known values of each element.
> What I am trying to do is find the "optimum" x1, x2 and x3 value per hour for this data set and my objective function is a minimum cost function.
>
> However, as you can see the "diesel_power_out" is some sort of implicit function which I am trying to solve simultaneously with linprog.
> Therefore I am trying to find the optimum "diesel_power_out" value for each of the 24 hours that meets the objective and criteria from the expression shown above as
>
> diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c
>


I for one, grasp little of the problem, as you've explained it. As far as I can tell, your diesel_power_out data is supposed to be the solution of the equation

 z=a*z^2+b*z+c

If so, the solution to the above is equivalent to finding the roots of the quadratic

 a*z^2+(b-1)*z+c = 0

and should be pretty trivial using the ROOTS command.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 6 Jul, 2012 22:57:44

Message: 3 of 36

On Friday, 6 July 2012 19:21:35 UTC+1, Andrew Alkiviades wrote:
> Hi I have the following code
>
>
> Diesel_cost_per_kWh = 0.4;
> a = 0.0082;
> b = 0.023;
> c = 0.253
>
> for j = 1:24
>
>
> diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c
>
>
> Diesel_cost(j) = diesel_power_out(j,i)*Diesel_cost_per_kWh
>
>
> A(j,:) = [-PV_supply(j,:) -WT_supply(j,:) -diesel_power_out(j,:)];
>
> b(j) = -Demand(j);
>
>
> f(:,j) = [CRF_PV*CC_PV/8760;CRF_WT*CC_WT/8760;CRF_Diesel_generator*CC_Diesel+Diesel_cost(j)/8760];
>
>
> [x(j,:),fval(:,j),exitflag(:,j)] = linprog(f(:,j),A(j,:),b(j))
>
> end
>
> Where PV_supply and WT_supply are 24x1 vectors with known values of each element.
> What I am trying to do is find the "optimum" x1, x2 and x3 value per hour for this data set and my objective function is a minimum cost function.
>
> However, as you can see the "diesel_power_out" is some sort of implicit function which I am trying to solve simultaneously with linprog.
> Therefore I am trying to find the optimum "diesel_power_out" value for each of the 24 hours that meets the objective and criteria from the expression shown above as
>
> diesel_power_out(j,:) = a*diesel_power_out(j)^2 + b*diesel_power_out(j) + c
>
> I am not really sure where to start, and was hoping for advice on this and if such a task is even possible.
> Do I need some sort of iteration that is taking place within the linprog for loop?
>
> Hope my question is clear, please let me know if more info/explanation is needed?

Hi Matt
Since the diesel_power_out is also a constraint in matrix "A" are you saying that I can find the point on the polynomial curve that satisfies the inequality constraint "A" and also minimizing the obj func with:
diesel_coef = (a b c );
 A(j,:) = [-PV_supply(j,:) -WT_supply(j,:) -roots(diesel_coef(j,:) ];

The important thing is that the solution can be anywhere on that curve as long as it minizimes the function and ofcourse meets constraints so with the roots function arent I just solving the polynomial only?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 6 Jul, 2012 23:17:25

Message: 4 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <ac0d4ab4-edc8-4dd0-932a-e606dc339ec2@googlegroups.com>...
>
> Since the diesel_power_out is also a constraint in matrix "A" are you saying that I can find the point on the polynomial curve that satisfies the inequality constraint "A" and also minimizing the obj func with:
=============

You haven't mentioned any constraints on diesel_power_out. Only on x1,x2,x3.

Now, you seem to say that diesel_power_out both determines the constraint matrix "A" and is also subject to those constraints????????????????

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 6 Jul, 2012 23:46:54

Message: 5 of 36

yes as I have shown in my first post the x3 coefficient of the objective function "f" depends on the "diesel_cost(j)" which is a function of "diesel_power_output". This "diesel_power_output" is also a coefficient of the x3 inequality constraint "A". So maybe the first question should be, is something like this possible?
i.e is it possible to find what the hourly diesel power output should be that will minimize the "diesel_cost" and also meet the inequality constraint?
hope that is clearer!

Subject: Implicit function within linprog for loop

From: Matt J

Date: 7 Jul, 2012 16:26:08

Message: 6 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <27613538-c9a4-492a-bc96-179194b5e5ac@googlegroups.com>...
> yes as I have shown in my first post the x3 coefficient of the objective function "f" depends on the "diesel_cost(j)" which is a function of "diesel_power_output". This "diesel_power_output" is also a coefficient of the x3 inequality constraint "A". So maybe the first question should be, is something like this possible?
> i.e is it possible to find what the hourly diesel power output should be that will minimize the "diesel_cost" and also meet the inequality constraint?
====================

Well, according to your original post, diesel_power_output has to be the root of a quadratic, so there are at most 2 values it can possibly have. You can check which of these values minimizes the diesel_cost. Once you've solved for diesel_power_output, you can plug it into the expressions for A and f and use LINPROG to see if the resulting linear program has a solution.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 7 Jul, 2012 16:54:51

Message: 7 of 36

On Saturday, 7 July 2012 17:26:08 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <27613538-c9a4-492a-bc96-179194b5e5ac@googlegroups.com>...
> > yes as I have shown in my first post the x3 coefficient of the objective function "f" depends on the "diesel_cost(j)" which is a function of "diesel_power_output". This "diesel_power_output" is also a coefficient of the x3 inequality constraint "A". So maybe the first question should be, is something like this possible?
> > i.e is it possible to find what the hourly diesel power output should be that will minimize the "diesel_cost" and also meet the inequality constraint?
> ====================
>
> Well, according to your original post, diesel_power_output has to be the root of a quadratic, so there are at most 2 values it can possibly have. You can check which of these values minimizes the diesel_cost. Once you've solved for diesel_power_output, you can plug it into the expressions for A and f and use LINPROG to see if the resulting linear program has a solution.

Yes but the thing is that that diesel_power_output is also a part of the constraint "A" so even though the diesel_cost may be a minimum at the roots, the overall function may not be right?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 7 Jul, 2012 17:17:09

Message: 8 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7c12f07d-5e0f-4dce-ae16-4f53aac4b2b7@googlegroups.com>...
>
> > Well, according to your original post, diesel_power_output has to be the root of a quadratic, so there are at most 2 values it can possibly have. You can check which of these values minimizes the diesel_cost. Once you've solved for diesel_power_output, you can plug it into the expressions for A and f and use LINPROG to see if the resulting linear program has a solution.
>
> Yes but the thing is that that diesel_power_output is also a part of the constraint "A" so even though the diesel_cost may be a minimum at the roots, the overall function may not be right?
=============

So, first of all, I don't think diesel_cost will be minimized at both roots. In your initial post, diesel_cost was proportional to diesel_power_output, so it will probably be minimized at the smallest root, the one which gives the smallest value of diesel_power_output.

But yes, what you seem to be saying is that you have 2 objective functions (f and diesel_cost), each one partly a function of diesel_power_output. There is no reason to expect that both objective functions can be minimized simultaneously for a single choice of diesel_power_output.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 7 Jul, 2012 17:30:51

Message: 9 of 36

On Saturday, 7 July 2012 18:17:09 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7c12f07d-5e0f-4dce-ae16-4f53aac4b2b7@googlegroups.com>...
> >
> > > Well, according to your original post, diesel_power_output has to be the root of a quadratic, so there are at most 2 values it can possibly have. You can check which of these values minimizes the diesel_cost. Once you've solved for diesel_power_output, you can plug it into the expressions for A and f and use LINPROG to see if the resulting linear program has a solution.
> >
> > Yes but the thing is that that diesel_power_output is also a part of the constraint "A" so even though the diesel_cost may be a minimum at the roots, the overall function may not be right?
> =============
>
> So, first of all, I don't think diesel_cost will be minimized at both roots. In your initial post, diesel_cost was proportional to diesel_power_output, so it will probably be minimized at the smallest root, the one which gives the smallest value of diesel_power_output.
>
> But yes, what you seem to be saying is that you have 2 objective functions (f and diesel_cost), each one partly a function of diesel_power_output. There is no reason to expect that both objective functions can be minimized simultaneously for a single choice of diesel_power_output.

Thanks Matt

See, physically speaking I am looking for the minimum capital cost of a diesel generator, PV module and wind turbine under the constraints (supply >= demand ) in matrix A.
I can treat the diesel consumption polynomial individually and find the diesel_power_output this satisfies. However, in the bigger picture, this diesel consumption should be changing per hour in the "for loop" so as to 1) meet constraints 2) minimise the initial objective function "f".

I guess one of the main reasons I posted this question is to ask whether or not such a task is achievable in which my understanding from you is that this cannot be done right?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 7 Jul, 2012 17:56:07

Message: 10 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <dc12fddc-a429-413f-8ef3-218094d2a030@googlegroups.com>...
> On Saturday, 7 July 2012 18:17:09 UTC+1, Matt J wrote:
> > Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7c12f07d-5e0f-4dce-ae16-4f53aac4b2b7@googlegroups.com>...
> > >
> > > > Well, according to your original post, diesel_power_output has to be the root of a quadratic, so there are at most 2 values it can possibly have. You can check which of these values minimizes the diesel_cost. Once you've solved for diesel_power_output, you can plug it into the expressions for A and f and use LINPROG to see if the resulting linear program has a solution.
> > >
> > > Yes but the thing is that that diesel_power_output is also a part of the constraint "A" so even though the diesel_cost may be a minimum at the roots, the overall function may not be right?
> > =============
> >
> > So, first of all, I don't think diesel_cost will be minimized at both roots. In your initial post, diesel_cost was proportional to diesel_power_output, so it will probably be minimized at the smallest root, the one which gives the smallest value of diesel_power_output.
> >
> > But yes, what you seem to be saying is that you have 2 objective functions (f and diesel_cost), each one partly a function of diesel_power_output. There is no reason to expect that both objective functions can be minimized simultaneously for a single choice of diesel_power_output.
>
> Thanks Matt
>
> See, physically speaking I am looking for the minimum capital cost of a diesel generator, PV module and wind turbine under the constraints (supply >= demand ) in matrix A.
> I can treat the diesel consumption polynomial individually and find the diesel_power_output this satisfies. However, in the bigger picture, this diesel consumption should be changing per hour in the "for loop" so as to 1) meet constraints 2) minimise the initial objective function "f".
>
> I guess one of the main reasons I posted this question is to ask whether or not such a task is achievable in which my understanding from you is that this cannot be done right?

It's achievable as long as you're only trying to minimize f*x, however, you keep saying that you're also trying to minimize not only f*x but a 2nd objective function as well called "diesel_cost". You can't minimize 2 things at the same time.

If you're now saying you only want to minimize f*x, then yes it's possible as long as I'm understanding the problem correctly. Below I have what I believe to be the mathematical formulation of your problem. To make discussion easier, I've relabeled diesel_power_output as z. So now you have 4 unknowns x2,x2,x3,z and you are trying to solve:

min f(z)*x

subject to constraints

A(z)*x<=demand
a*z^2+(b-1)*z+c=0

The dependence of f(z) and A(z) are not important. It is only important to know that for a fixed z, you get a linear program in x. There are at most two possible values that z can have satisfying the quadratic equality constraint above. So, for each of those choices z1 and z2, you can solve the corresponding linear program and take the best of the optimal objective values f(z1)*x or f(z2)*x

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 8 Jul, 2012 19:32:57

Message: 11 of 36

Matt thank you for you help and sorry for the confusion but I have come across a new equation that may help

remember that I am trying to optimise the cost function "f". The problem I have is that I know the values in the vector "PV_supply" and "WT_supply" of which I am looking for the number of units as (x1 an x2) but I don't know the values in "Diesel_supply" which i am of course trying to find out (as well as the number of units)

I have come across the equation

Diesel_cost = diesel_cost_litres*( b*diesel_generator_capacity + a*diesel_supply)
where a and b and diesel_cost_litres are constants.

I can predetermine the "diesel_generator_capacity" value, but this would represent the maximum value that the "diesel_supply" could ever reach (and doesn't necessarily have to reach).

I think that what I am trying to achieve is quite complex since I cannot replicate the 24x1 vector which has known elements of PV_supply and WT_supply for Diesel_supply since I am trying for the code to output not only the "Diesel_supply" values but also the number of units (x3).

Else

It may be simpler to say that I am going to predetermine the number of units of diesel i.e. set x3 = 1 with again a predetermined value of "diesel_generator_capacity" (say 200kW).
In that case I will only have the "diesel_supply" unknown (from the new equation in this post)
and some how that way minimise the "Diesel_cost" over the 24x1 values?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 8 Jul, 2012 20:05:07

Message: 12 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <e155ab0f-b3a4-46a4-94d6-0df95834f7a7@googlegroups.com>...
> Matt thank you for you help and sorry for the confusion but I have come across a new equation that may help
>
> remember that I am trying to optimise the cost function "f". The problem I have is that I know the values in the vector "PV_supply" and "WT_supply" of which I am looking for the number of units as (x1 an x2) but I don't know the values in "Diesel_supply" which i am of course trying to find out (as well as the number of units)
>
> I have come across the equation
>
> Diesel_cost = diesel_cost_litres*( b*diesel_generator_capacity + a*diesel_supply)
> where a and b and diesel_cost_litres are constants.
>
> I can predetermine the "diesel_generator_capacity" value, but this would represent the maximum value that the "diesel_supply" could ever reach (and doesn't necessarily have to reach).
>
> I think that what I am trying to achieve is quite complex since I cannot replicate the 24x1 vector which has known elements of PV_supply and WT_supply for Diesel_supply since I am trying for the code to output not only the "Diesel_supply" values but also the number of units (x3).
>
> Else
>
> It may be simpler to say that I am going to predetermine the number of units of diesel i.e. set x3 = 1 with again a predetermined value of "diesel_generator_capacity" (say 200kW).
> In that case I will only have the "diesel_supply" unknown (from the new equation in this post)
> and some how that way minimise the "Diesel_cost" over the 24x1 values?
================

Hi Andrew, I think I need to emphasize something to make discussion easier. We, the Newsgroup, do not understand your application at all and aren't going to. The only thing that's going to be clear to us is a mathematical formulation of what you are trying to achieve, similar to what I gave in my last post and which I've reproduced below. If you've come across new information, the only thing that's going to help us understand what's going on is if you now rewrite the description of the optimization problem (in the same general form as below) to show us how that new information changes the problem.


min f(z)*x

subject to constraints

A(z)*x<=demand
a*z^2+(b-1)*z+c=0

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 15:18:13

Message: 13 of 36

Hi Matt

Yes you are right, I do sometimes assume that people know what I am talking about in the physical sense and will try and focus more on the mathematical representation - apologies for this.

So to rewrite my previous question :

I have the following code:

Diesel_cost = sum(Diesel_supply*0.4);

A = [-PV_supply -WT_supply -Diesel_supply ];
b = -Demand;
f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];
[x,fval,exitflag] = linprog(f,A,b)

Where PV_supply and WT_supply and Diesel_supply are 24x1 and Demand is 24x1 and so f = 3x1.

Where I am struggling is with the fact that I have too many unknown variables. This is because the values in PV_supply and WT_supply vectors are given to me but the diesel_supply values are not (even though I have shown it in "A") I am just trying to optimise the number of units equivalent to x1,x2 and x3, but in the case of Diesel_supply I don't even know the values in the vector.

What I do know is the following:
Demand - PV_supply*x1 - WT_supply*x2 <= Diesel_supply*x3

Therefore I am looking for the optimum "Diesel_supply" which all I know is the size of (i.e 24x1) and I could assume a max(Diesel_supply) value (e.g 200) if this was to help.
 
Also I have come across the equation below that represent the "diesel_supply" variable with the "Diesel_cost" variable shown in the inequality matrix "A" and objective function "f" respectively.

Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)

Where a and b and scalar constants and the "diesel_supply" in the equation above is the same as the "diesel_supply" in the objective function "f" and I could again fix the "diesel_generator"capacity" to a value of my choice again say 200 and "Diesel_cost_litres" is = 0.4.

Therefore, from the equation above, only the "diesel_supply" variable is unknown and should be varying across each of the 24 values of the data set.

I hope this post articulates a much clearer image of my problem and the fact that I seem to have something like an "implicit function" when it comes to the "Diesel_supply" variable since I am hoping to construct a code that will propose the element value of each of the 24 elements of the "Diesel_supply" and well as the optimum number of units - which is represented by x3.

thank you

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 15:34:18

Message: 14 of 36

Hi Matt

Yes you are right, I do sometimes assume that people know what I am talking about in the physical sense and will try and focus more on the mathematical representation - apologies for this.

So to rewrite my previous question :

I have the following code:

Diesel_cost = sum(Diesel_supply*0.4);

A = [-PV_supply -WT_supply -Diesel_supply ];
b = -Demand;
f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];
[x,fval,exitflag] = linprog(f,A,b)

Where PV_supply and WT_supply and Diesel_supply are 24x1 and Demand is 24x1 and so f = 3x1.

Where I am struggling is with the fact that I have too many unknown variables. This is because the values in PV_supply and WT_supply vectors are given to me but the diesel_supply values are not (even though I have shown it in "A") I am just trying to optimise the number of units equivalent to x1,x2 and x3, but in the case of Diesel_supply I don't even know the values in the vector.

What I do know is the following:
Demand - PV_supply*x1 - WT_supply*x2 <= Diesel_supply*x3

Therefore I am looking for the optimum "Diesel_supply" which all I know is the size of (i.e 24x1) and I could assume a max(Diesel_supply) value (e.g 200) if this was to help.
 
Also I have come across the equation below that represent the "diesel_supply" variable with the "Diesel_cost" variable shown in the inequality matrix "A" and objective function "f" respectively.

Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)

Where a and b and scalar constants and the "diesel_supply" in the equation above is the same as the "diesel_supply" in the objective function "f" and I could again fix the "diesel_generator"capacity" to a value of my choice again say 200 and "Diesel_cost_litres" is = 0.4.

Therefore, from the equation above, only the "diesel_supply" variable is unknown and should be varying across each of the 24 values of the data set.

I hope this post articulates a much clearer image of my problem and the fact that I seem to have something like an "implicit function" when it comes to the "Diesel_supply" variable since I am hoping to construct a code that will propose the element value of each of the 24 elements of the "Diesel_supply" and well as the optimum number of units - which is represented by x3.

thank you

Subject: Implicit function within linprog for loop

From: Matt J

Date: 9 Jul, 2012 16:14:07

Message: 15 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <5a9cf315-eae7-409d-8ab9-19969a381237@googlegroups.com>...
> Hi Matt
>
> Yes you are right, I do sometimes assume that people know what I am talking about in the physical sense and will try and focus more on the mathematical representation - apologies for this.
>
> So to rewrite my previous question :
>
> I have the following code:
>
> Diesel_cost = sum(Diesel_supply*0.4);
>
> A = [-PV_supply -WT_supply -Diesel_supply ];
> b = -Demand;
> f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];
> [x,fval,exitflag] = linprog(f,A,b)
>
> Where PV_supply and WT_supply and Diesel_supply are 24x1 and Demand is 24x1 and so f = 3x1.
>
> Where I am struggling is with the fact that I have too many unknown variables. This is because the values in PV_supply and WT_supply vectors are given to me but the diesel_supply values are not (even though I have shown it in "A") I am just trying to optimise the number of units equivalent to x1,x2 and x3, but in the case of Diesel_supply I don't even know the values in the vector.
>
> What I do know is the following:
> Demand - PV_supply*x1 - WT_supply*x2 <= Diesel_supply*x3
>
> Therefore I am looking for the optimum "Diesel_supply" which all I know is the size of (i.e 24x1) and I could assume a max(Diesel_supply) value (e.g 200) if this was to help.
>
> Also I have come across the equation below that represent the "diesel_supply" variable with the "Diesel_cost" variable shown in the inequality matrix "A" and objective function "f" respectively.
>
> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)
>
> Where a and b and scalar constants and the "diesel_supply" in the equation above is the same as the "diesel_supply" in the objective function "f" and I could again fix the "diesel_generator"capacity" to a value of my choice again say 200 and "Diesel_cost_litres" is = 0.4.
>
> Therefore, from the equation above, only the "diesel_supply" variable is unknown and should be varying across each of the 24 values of the data set.
>
> I hope this post articulates a much clearer image of my problem and the fact that I seem to have something like an "implicit function" when it comes to the "Diesel_supply" variable since I am hoping to construct a code that will propose the element value of each of the 24 elements of the "Diesel_supply" and well as the optimum number of units - which is represented by x3.
===========

Yes, this is clearer. The solution is probably to introduce a 4th unknown variable x4 where

x4=diesel_supply*x3

This will let you rewrite your original linear program as a linear program in the 4 variables x1...x4. In particular, if you substitute your equation

Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)

into the equation for f

 f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];

then you will see that you get a new linear objective function in the 4 unknowns x1...x4

Your linear constraints get modified in a similar way and will lead to a constraint matrix A that is now Nx4.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 16:36:39

Message: 16 of 36

hi

On Monday, 9 July 2012 17:14:07 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <5a9cf315-eae7-409d-8ab9-19969a381237@googlegroups.com>...
> > Hi Matt
> >
> > Yes you are right, I do sometimes assume that people know what I am talking about in the physical sense and will try and focus more on the mathematical representation - apologies for this.
> >
> > So to rewrite my previous question :
> >
> > I have the following code:
> >
> > Diesel_cost = sum(Diesel_supply*0.4);
> >
> > A = [-PV_supply -WT_supply -Diesel_supply ];
> > b = -Demand;
> > f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];
> > [x,fval,exitflag] = linprog(f,A,b)
> >
> > Where PV_supply and WT_supply and Diesel_supply are 24x1 and Demand is 24x1 and so f = 3x1.
> >
> > Where I am struggling is with the fact that I have too many unknown variables. This is because the values in PV_supply and WT_supply vectors are given to me but the diesel_supply values are not (even though I have shown it in "A") I am just trying to optimise the number of units equivalent to x1,x2 and x3, but in the case of Diesel_supply I don't even know the values in the vector.
> >
> > What I do know is the following:
> > Demand - PV_supply*x1 - WT_supply*x2 <= Diesel_supply*x3
> >
> > Therefore I am looking for the optimum "Diesel_supply" which all I know is the size of (i.e 24x1) and I could assume a max(Diesel_supply) value (e.g 200) if this was to help.
> >
> > Also I have come across the equation below that represent the "diesel_supply" variable with the "Diesel_cost" variable shown in the inequality matrix "A" and objective function "f" respectively.
> >
> > Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)
> >
> > Where a and b and scalar constants and the "diesel_supply" in the equation above is the same as the "diesel_supply" in the objective function "f" and I could again fix the "diesel_generator"capacity" to a value of my choice again say 200 and "Diesel_cost_litres" is = 0.4.
> >
> > Therefore, from the equation above, only the "diesel_supply" variable is unknown and should be varying across each of the 24 values of the data set.
> >
> > I hope this post articulates a much clearer image of my problem and the fact that I seem to have something like an "implicit function" when it comes to the "Diesel_supply" variable since I am hoping to construct a code that will propose the element value of each of the 24 elements of the "Diesel_supply" and well as the optimum number of units - which is represented by x3.
> ===========
>
> Yes, this is clearer. The solution is probably to introduce a 4th unknown variable x4 where
>
> x4=diesel_supply*x3
>
> This will let you rewrite your original linear program as a linear program in the 4 variables x1...x4. In particular, if you substitute your equation
>
> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)
>
> into the equation for f
>
> f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+Diesel_cost];
>
> then you will see that you get a new linear objective function in the 4 unknowns x1...x4
>
> Your linear constraints get modified in a similar way and will lead to a constraint matrix A that is now Nx4.

Hi Matt

Thank you for your reply

I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question

1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
 Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?


2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)

3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions

Thank you

Subject: Implicit function within linprog for loop

From: Matt J

Date: 9 Jul, 2012 17:28:18

Message: 17 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
>
>
> I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
>
> 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
=========

What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).


> Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
=============

Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving

x(4)=diesel_supply*x(3)


 
> 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
==========

Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.


> 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
========

Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 18:40:30

Message: 18 of 36

On Monday, 9 July 2012 18:28:18 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
> >
> >
> > I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
> >
> > 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
> =========
>
> What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).
>
>
> > Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
> =============
>
> Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving
>
> x(4)=diesel_supply*x(3)
>
>
>
> > 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
> ==========
>
> Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.
>
>
> > 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
> ========
>
> Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.

Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
In that sense, I am struggling to see how if I add a fourth variable, I will get a result that makes physical sense as well.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 18:46:07

Message: 19 of 36

On Monday, 9 July 2012 19:40:30 UTC+1, Andrew Alkiviades wrote:
> On Monday, 9 July 2012 18:28:18 UTC+1, Matt J wrote:
> > Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
> > >
> > >
> > > I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
> > >
> > > 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
> > =========
> >
> > What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).
> >
> >
> > > Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
> > =============
> >
> > Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving
> >
> > x(4)=diesel_supply*x(3)
> >
> >
> >
> > > 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
> > ==========
> >
> > Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.
> >
> >
> > > 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
> > ========
> >
> > Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.
>
> Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
> Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
> In that sense, I am struggling to see how if I add a fourth variable, I will get a result that makes physical sense as well.



On Monday, 9 July 2012 19:40:30 UTC+1, Andrew Alkiviades wrote:
> On Monday, 9 July 2012 18:28:18 UTC+1, Matt J wrote:
> > Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
> > >
> > >
> > > I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
> > >
> > > 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
> > =========
> >
> > What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).
> >
> >
> > > Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
> > =============
> >
> > Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving
> >
> > x(4)=diesel_supply*x(3)
> >
> >
> >
> > > 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
> > ==========
> >
> > Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.
> >
> >
> > > 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
> > ========
> >
> > Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.
>
> Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
> Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
> In that sense, I am struggling to see how if I add a fourth variable, I will get a result that makes physical sense as well.



On Monday, 9 July 2012 19:40:30 UTC+1, Andrew Alkiviades wrote:
> On Monday, 9 July 2012 18:28:18 UTC+1, Matt J wrote:
> > Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
> > >
> > >
> > > I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
> > >
> > > 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
> > =========
> >
> > What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).
> >
> >
> > > Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
> > =============
> >
> > Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving
> >
> > x(4)=diesel_supply*x(3)
> >
> >
> >
> > > 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
> > ==========
> >
> > Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.
> >
> >
> > > 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
> > ========
> >
> > Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.
>
> Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
> Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
> In that sense, I am struggling to see how if I add a fourth variable, I will get a result that makes physical sense as well.



On Monday, 9 July 2012 19:40:30 UTC+1, Andrew Alkiviades wrote:
> On Monday, 9 July 2012 18:28:18 UTC+1, Matt J wrote:
> > Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <7ab5575a-8e35-4903-b822-b95ec3b12757@googlegroups.com>...
> > >
> > >
> > > I am not quite sure I have understood your suggestions entirely and have listed a couple of points below which I hope will help asking my question
> > >
> > > 1) You mentioned introducing an x(4)=diesel_supply*x(3). However, if x(3) is an unknown that linprog should output, how can I compute such a command?
> > =========
> >
> > What I'm saying is this. If you write out explicit expressions for the constraints A*x(1:3) and objective function f*x(1:3), you will see that they all depend on diesel_supply only through the expression "diesel_supply*x(3)". So, you should simply define this expression as an additional unknown x(4). If you then go through the expressions for your objective/constraints and replace every occurrence of "diesel_supply*x(3)" with the new variable x(4), you will find that you have a new linear program in 4 variables x(1)...x(4).
> >
> >
> > > Also, I am trying to output the "diesel_supply" vector so how can I compute these unknowns for x(4) since your suggested x(4) seems to be my proposed x(3), therefore what will the new x(3) represent?
> > =============
> >
> > Once you use linprog to solve for x(3) and x(4), you can recover diesel_supply by solving
> >
> > x(4)=diesel_supply*x(3)
> >
> >
> >
> > > 2) You mentioned to substitute "> Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) " in "f". However, isn't the "diesel_supply" vector unknown that we are trying to output as a solution (as well as optimum x1,x2 etc)
> > ==========
> >
> > Yes, but why does that matter? Whenever you write down any equation, it will consist of some quantities that are known and some that are unknown.
> >
> >
> > > 3) Also, how can I expand the matrix "A" to include the x(4) - maybe this will be clearer to me once I understand your suggestions
> > ========
> >
> > Once you write down the expression for A*x(1:3) as individual inequalities and make the substitution x(4) diesel_supply*x(3) you will have expressions for a new set of linear inequalities, this time in 4 variables. Just organize the coefficients of these 4 variables into a new 4-column matrix A.
>
> Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
> Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
> In that sense, I am struggling to see how if I add a fourth variable, I will get a result that makes physical sense as well.

Subject: Implicit function within linprog for loop

From: Matt J

Date: 9 Jul, 2012 19:49:26

Message: 20 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <8e8cd549-2b6f-437d-bfed-4aa56b2bbff3@googlegroups.com>...
>
>
> Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
=============

Preliminary remark - I'm assuming that diesel_supply is a scalar. If not, this conflicts with other information you've given. In the formula you gave for f, diesel_cost played the role of a scalar and in the formula you gave for diesel_cost, diesel_supply played the role of a scalar as well. If you're now telling me diesel_supply is a vector, the sizes of other things in your problem are now inconsistent with each other.



> Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
=============

You keep referring to diesel_supply as a "coefficient". You should stop that. Since diesel_supply is apriori unknown, you need to stop thinking of it as a coefficient and start thinking of it as yet another unknown variable that you need to solve for, just like x(1), x(2), x(3).

Also, you should realize that when you multiply 2 unknowns together, you get another unknown. So, instead of solving for x(1), x(2), x(3), and Diesel_supply, I propose that we solve for the four quantities x(1), x(2), x(3), and Diesel_supply*x(3). Furthermore, I propose that we relabel the quantity Diesel_supply*x(3) as a new variable x(4). There is no loss of information if we do this. There are 4 degrees of freedom no matter how we label the unknowns.

If we do this relabeling, then your first inequality above can be rewritten

PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+ 0*x(3) + 1*x(4) >= Demand (1,1).

That is, your 4 coefficients in the equality are now
 
PV_supply(1,1)
WT_supply(1,1)
0
1

The slight problem this reveals is that since the coefficient of x(3) is now always zero, then x(3) is now unconstrained. You need to provide additional information on x(3) so that it will be well-specified in this 4 dimensional problem.

However, that was inevitable. Because you've added a 4th degree of freedom, whether you call it diesel_supply or x(4), you need extra information to specify it.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 19:55:10

Message: 21 of 36

On Monday, 9 July 2012 20:49:26 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <8e8cd549-2b6f-437d-bfed-4aa56b2bbff3@googlegroups.com>...
> >
> >
> > Matt - I am afraid I still don't understand the thought behind your suggestion. This is mainly because I can't see the solution to the inequality say for first row of "A" which is
> > PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+Diesel_supply(1,1)*x(3) >= Demand (1,1).
> > At this stage what the complexity involved is that there is no definition for the "Diesel_supply" component of "A". All I know is the size.
> =============
>
> Preliminary remark - I'm assuming that diesel_supply is a scalar. If not, this conflicts with other information you've given. In the formula you gave for f, diesel_cost played the role of a scalar and in the formula you gave for diesel_cost, diesel_supply played the role of a scalar as well. If you're now telling me diesel_supply is a vector, the sizes of other things in your problem are now inconsistent with each other.
>
>
>
> > Therefore not only am I trying to optimise the x's using the coefficients, in this case I don't actually have any coefficients for the "Diesel_supply" component.
> =============
>
> You keep referring to diesel_supply as a "coefficient". You should stop that. Since diesel_supply is apriori unknown, you need to stop thinking of it as a coefficient and start thinking of it as yet another unknown variable that you need to solve for, just like x(1), x(2), x(3).
>
> Also, you should realize that when you multiply 2 unknowns together, you get another unknown. So, instead of solving for x(1), x(2), x(3), and Diesel_supply, I propose that we solve for the four quantities x(1), x(2), x(3), and Diesel_supply*x(3). Furthermore, I propose that we relabel the quantity Diesel_supply*x(3) as a new variable x(4). There is no loss of information if we do this. There are 4 degrees of freedom no matter how we label the unknowns.
>
> If we do this relabeling, then your first inequality above can be rewritten
>
> PV_supply(1,1)*x(1) + WT_supply(1,1)*x(2)+ 0*x(3) + 1*x(4) >= Demand (1,1).
>
> That is, your 4 coefficients in the equality are now
>
> PV_supply(1,1)
> WT_supply(1,1)
> 0
> 1
>
> The slight problem this reveals is that since the coefficient of x(3) is now always zero, then x(3) is now unconstrained. You need to provide additional information on x(3) so that it will be well-specified in this 4 dimensional problem.
>
> However, that was inevitable. Because you've added a 4th degree of freedom, whether you call it diesel_supply or x(4), you need extra information to specify it.

Matt
Apologies for the confusion but as I have said in my previous posts, "Diesel_supply" is a vector which has the same size as PV_supply and WT_supply.

The reason I am saying about the coefficients is because the x's represent the "number of units" of a certain technology. The three values shown in "f" are scalars.

Subject: Implicit function within linprog for loop

From: Matt J

Date: 9 Jul, 2012 20:25:21

Message: 22 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <514a30be-e21a-4fef-81dd-87e7d9c0f926@googlegroups.com>...
>
>
> Matt
> Apologies for the confusion but as I have said in my previous posts, "Diesel_supply" is a vector which has the same size as PV_supply and WT_supply.
>...The three values shown in "f" are scalars.
==================

If so, then I say again, that creates inconsistencies. If f indeed contains 3 scalars, then Diesel_cost has to be a scalar in your expression below

 f = [CRF_PV*CC_PV; CRF_WT*CC_WT;(CRF_Diesel_generator*CC_Diesel)+Diesel_cost];

If we agree that Diesel_cost is a scalar, then diesel_supply has to be a scalar in this next definition,

 Diesel_cost = Diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply)

since you've said everything else in it this definition is a scalar.

So, am I to conclude there is a difference between the quantity you have labelled "diesel_supply" with a lower-case d and "Diesel_supply" with an uppercase D?




> The reason I am saying about the coefficients is because the x's represent the "number of units" of a certain technology.
=================

That might be your reason, but it's irrelevant to the point I was making. The point was that Diesel_supply has to be treated like an unknown variable to be solved for (because it is).

Even if Diesel_supply is a vector, my remarks from before may still apply. The quantity Diesel_supply*x(3) can be treated as a vector of additional unknown variables [x(4)....x(N)] and the dependence of the constraints on these new variables is still linear. If you can come up with additional linear constraints to deal with the new degrees of freedom that this introduces, you may be able to use LINPROG to solve for all N variables.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 21:39:31

Message: 23 of 36

Matt

Yes the diesel_cost is a scalar that is the sum of all the diesel_supply values multiplied by a constant. There is no differentiation between upper and lower case characters.
diesel_supply is the 24x1 vector of unknown values (as well as unknown x3 etc..

the equation:
diesel_cost = diesel_cost_litres * ( b*diesel_generator_capacity + a*diesel_supply) is only implemented for each value of the 24 rows. therefore I should in fact introduce a new variable as say "total_diesel_cost" , where total_diesel_cost = sum(diesel_cost) that is then substituted to the objective function "f" vector - my apologies.

I think I have been a little confused with the x(4)...x(N) notation as I actually have the unknown values say "diesel_1 ... Diesel_N as well as the "diesel_supply" vector = [diesel_1*x(3); diesel_2*x(4)...diesel_N*x(N) etc] right?

Also, regarding the added constraints you mentioned, are these necessary?

Could you possibly show me one line of how the a matrix would look like with your suggestion?

Thank you

Subject: Implicit function within linprog for loop

From: Matt J

Date: 9 Jul, 2012 22:00:10

Message: 24 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <377cc6a2-3ee5-4c0b-a6b4-565b6eae9d25@googlegroups.com>...
>
> I think I have been a little confused with the x(4)...x(N) notation as I actually have the unknown values say "diesel_1 ... Diesel_N as well as the "diesel_supply" vector = [diesel_1*x(3); diesel_2*x(4)...diesel_N*x(N) etc] right?
===========

Don't know where that came from. I don't think you've mentioned diesel_1..diesel_N before.


> Also, regarding the added constraints you mentioned, are these necessary?
============

Well, you have 26 unknowns in total. You therefore probably need at least that many constraints. Currently, you're only imposing 24.


> Could you possibly show me one line of how the a matrix would look like with your suggestion?
==============

The first line of the matrix will look the same as I described 2 posts ago.
The second line will look the same except with x(5) instead of x(4), etc...

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 9 Jul, 2012 23:10:14

Message: 25 of 36

On Monday, 9 July 2012 23:00:10 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <377cc6a2-3ee5-4c0b-a6b4-565b6eae9d25@googlegroups.com>...
> >
> > I think I have been a little confused with the x(4)...x(N) notation as I actually have the unknown values say "diesel_1 ... Diesel_N as well as the "diesel_supply" vector = [diesel_1*x(3); diesel_2*x(4)...diesel_N*x(N) etc] right?
> ===========
>
> Don't know where that came from. I don't think you've mentioned diesel_1..diesel_N before.
>
>
> > Also, regarding the added constraints you mentioned, are these necessary?
> ============
>
> Well, you have 26 unknowns in total. You therefore probably need at least that many constraints. Currently, you're only imposing 24.
>
>
> > Could you possibly show me one line of how the a matrix would look like with your suggestion?
> ==============
>
> The first line of the matrix will look the same as I described 2 posts ago.
> The second line will look the same except with x(5) instead of x(4), etc...

is this what you mean?
zero_test = zeros(24,1);
    one_test = ones(24,1);
A = [-PV_supply -WT_supply zero_test -one_test ]; ?

I might take some time to understand what your suggestion is since I am really not sure what you mean.
I am still not sure about how I can "overcome" the problem of having a vector with unknown elements. I am also trying to understand how the code makes physical sense as well which I need to think about - this is also because the "diesel_cost" in the "f" should be accounted for in the minization and somehow represented in the constraints


Thank you for your help and patience and I will get back with more questions very soon!

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 10 Jul, 2012 11:38:42

Message: 26 of 36

Just a quick question to make sure

Is there any way of doing something like - or in the form of

A = [-PV_supply -WT_supply -Demand-(PV_supply*x(1)+WT_supply*x(2))]

where x(2) and x(3) are the outputs I am looking for?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 10 Jul, 2012 14:36:14

Message: 27 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <dffc714f-4dcc-4e20-bf02-6dca5a993b8c@googlegroups.com>...
>
>
>Is there any way of doing something like - or in the form of
>
>A = [-PV_supply -WT_supply -Demand-(PV_supply*x(1)+WT_supply*x(2))]
>
>where x(2) and x(3) are the outputs I am looking for?
===============


No. In a linear program, the constraint coefficients in the A matrix have to be known constants. They cannot depend on your unknown variables.



> > The first line of the matrix will look the same as I described 2 posts ago.
> > The second line will look the same except with x(5) instead of x(4), etc...
>
> is this what you mean?
> zero_test = zeros(24,1);
> one_test = ones(24,1);
> A = [-PV_supply -WT_supply zero_test -one_test ]; ?
==============


Sorry, there was a mistake in what I described to you earlier. The A matrix would really look like this

A = [-PV_supply, -WT_supply, zero_test, eye(24) ];

The resulting matrix should be 24x27 because you have 27 unknowns, consisting of the 24 unknown quantities associated with each Diesel_supply(j), j=1...24, plus
x1,x2,x3.



> I am still not sure about how I can "overcome" the problem of having a vector with unknown elements.
=============

Not sure why that's a "new problem". You've always had a vector of unknown elements consisting at the very least of [x1,x2,x3].



> I am also trying to understand how the code makes physical sense as well which I need to think about
===========

I myself am starting to think that you don't have enough physical information to solve the problem. According to what you've been telling me, you have 27 unknowns and very few constraints on them.



>this is also because the "diesel_cost" in the "f" should be accounted for in the minization and somehow represented in the constraints
=============

diesel_cost really shouldn't be in your f vector because it is a priori unknown. Similar to what I said above about A, the f vector must consist of apriori known constants.



 

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 17:22:21

Message: 28 of 36

On Tuesday, 10 July 2012 15:36:14 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <dffc714f-4dcc-4e20-bf02-6dca5a993b8c@googlegroups.com>...
> >
> >
> >Is there any way of doing something like - or in the form of
> >
> >A = [-PV_supply -WT_supply -Demand-(PV_supply*x(1)+WT_supply*x(2))]
> >
> >where x(2) and x(3) are the outputs I am looking for?
> ===============
>
>
> No. In a linear program, the constraint coefficients in the A matrix have to be known constants. They cannot depend on your unknown variables.
>
>
>
> > > The first line of the matrix will look the same as I described 2 posts ago.
> > > The second line will look the same except with x(5) instead of x(4), etc...
> >
> > is this what you mean?
> > zero_test = zeros(24,1);
> > one_test = ones(24,1);
> > A = [-PV_supply -WT_supply zero_test -one_test ]; ?
> ==============
>
>
> Sorry, there was a mistake in what I described to you earlier. The A matrix would really look like this
>
> A = [-PV_supply, -WT_supply, zero_test, eye(24) ];
>
> The resulting matrix should be 24x27 because you have 27 unknowns, consisting of the 24 unknown quantities associated with each Diesel_supply(j), j=1...24, plus
> x1,x2,x3.
>
>
>
> > I am still not sure about how I can "overcome" the problem of having a vector with unknown elements.
> =============
>
> Not sure why that's a "new problem". You've always had a vector of unknown elements consisting at the very least of [x1,x2,x3].
>
>
>
> > I am also trying to understand how the code makes physical sense as well which I need to think about
> ===========
>
> I myself am starting to think that you don't have enough physical information to solve the problem. According to what you've been telling me, you have 27 unknowns and very few constraints on them.
>
>
>
> >this is also because the "diesel_cost" in the "f" should be accounted for in the minization and somehow represented in the constraints
> =============
>
> diesel_cost really shouldn't be in your f vector because it is a priori unknown. Similar to what I said above about A, the f vector must consist of apriori known constants.

Matt

Can I make a suggestion and hear your feedback in light of some new info come across for this code.

Am a able to add a "floating " point for the actual value of the "diesel_supply" vector that is a component of the matrix "A"? ( sine this value is in fact unknown initially)

This is because I am now aware of a linear relationship between the "diesel_supply" column in "A" and "diesel_cost" scalar value in "f" (where diesel_cost = sum(hourly_diesel_cost))

In fact if I put some numbers to further explain.
"diesel_supply" is in column 1
"hourly_diesel_cost" is in column 2
0 0
10 44.619
20 45.918
30 47.217
40 48.516
50 49.815
60 51.114
70 52.413
80 53.712
90 55.011
100 56.31
110 57.609
120 58.908
130 60.207
140 61.506
150 62.805
160 64.104
170 65.403
180 66.702
190 68.001
200 69.3

Therefore not only am I trying to optimize for x(3) I am at the same time trying to find where the "diesel_supply" value must be sitting for each of the 24 hours in the data set


hope that makes sense?

I believe that some sort of iteration must be required for "diesel_supply" only - is it first of all possible to iterate only one column of the "A" matrix and was hoping for some help on this

I am interested to hear your thoughts on this

Thank you

Subject: Implicit function within linprog for loop

From: Matt J

Date: 11 Jul, 2012 18:25:12

Message: 29 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <04881223-592b-4344-892e-dfd38c1b06bf@googlegroups.com>...
>
>
> Therefore not only am I trying to optimize for x(3) I am at the same time trying to find where the "diesel_supply" value must be sitting for each of the 24 hours in the data set
>
>
> hope that makes sense?
==========

Maybe. As far as I can understand it, you are now treating the diesel_supply values as unknowns, just as we've been discussing.


> I believe that some sort of iteration must be required for "diesel_supply" only - is it first of all possible to iterate only one column of the "A" matrix and was hoping for some help on this
>
> I am interested to hear your thoughts on this
============

Don't have any thoughts on this, I'm afraid. I don't see why you need to iterate over diesel_supply or give it any kind of separate treatment, especially since you now say you have additional linear constraints to control it.

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 18:46:02

Message: 30 of 36

On Wednesday, 11 July 2012 19:25:12 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <04881223-592b-4344-892e-dfd38c1b06bf@googlegroups.com>...
> >
> >
> > Therefore not only am I trying to optimize for x(3) I am at the same time trying to find where the "diesel_supply" value must be sitting for each of the 24 hours in the data set
> >
> >
> > hope that makes sense?
> ==========
>
> Maybe. As far as I can understand it, you are now treating the diesel_supply values as unknowns, just as we've been discussing.
>
>
> > I believe that some sort of iteration must be required for "diesel_supply" only - is it first of all possible to iterate only one column of the "A" matrix and was hoping for some help on this
> >
> > I am interested to hear your thoughts on this
> ============
>
> Don't have any thoughts on this, I'm afraid. I don't see why you need to iterate over diesel_supply or give it any kind of separate treatment, especially since you now say you have additional linear constraints to control it.

I think I need to iterate because the data set I copied above aren't constraints - they are just an operating point and the respective cost

Diesel_matrix = xlsread('test_diesel.xlsx','Sheet2');


Diesel_supply = Diesel_matrix(:,1); % Power output of diesel generator
hourly_cost = Diesel_matrix(:,2); % Diesel cost of running genreator at that output

for z = 1 : 21
         
 A = [-PV_supply -WT_supply -Diesel_supply(z)];
 
   f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] % how do we manipulate diesel cost?
 
 b = -Demand;
 
 [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)


end

what I have tried above so far gives me an inconsistent matrix size since I think it is not looping correctly

Subject: Implicit function within linprog for loop

From: Matt J

Date: 11 Jul, 2012 19:59:13

Message: 31 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <607ba0c7-907f-473c-8328-43ca4bdd2202@googlegroups.com>...
>
>
> for z = 1 : 21
>
> A = [-PV_supply -WT_supply -Diesel_supply(z)];
>
> f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] % how do we manipulate diesel cost?
>
> b = -Demand;
>
> [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
>
>
> end
>
> what I have tried above so far gives me an inconsistent matrix size since I think it is not looping correctly
=====================


Probably because in this expression

A = [-PV_supply -WT_supply -Diesel_supply(z)]

you are concatenating 2 vectors with the scalar Diesel_supply(z)

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 20:04:47

Message: 32 of 36

On Wednesday, 11 July 2012 20:59:13 UTC+1, Matt J wrote:
> Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <607ba0c7-907f-473c-8328-43ca4bdd2202@googlegroups.com>...
> >
> >
> > for z = 1 : 21
> >
> > A = [-PV_supply -WT_supply -Diesel_supply(z)];
> >
> > f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] % how do we manipulate diesel cost?
> >
> > b = -Demand;
> >
> > [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
> >
> >
> > end
> >
> > what I have tried above so far gives me an inconsistent matrix size since I think it is not looping correctly
> =====================
>
>
> Probably because in this expression
>
> A = [-PV_supply -WT_supply -Diesel_supply(z)]
>
> you are concatenating 2 vectors with the scalar Diesel_supply(z)

Indeed I have adjusted to
 for z = 1:21
 A= [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];
 
   f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] ;

 
 b = -Demand;
 
 [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)

 end
 
However, this of course only gives the "Diesel_supply" value for z = 21.
I need to index the LHS of the A equation, do you know how this is done?
Thank you

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 20:07:42

Message: 33 of 36

On Wednesday, 11 July 2012 21:04:47 UTC+1, Andrew Alkiviades wrote:
> On Wednesday, 11 July 2012 20:59:13 UTC+1, Matt J wrote:
> > Andrew Alkiviades &lt;andrew.alkiviades@gmail.com&gt; wrote in message &lt;607ba0c7-907f-473c-8328-43ca4bdd2202@googlegroups.com&gt;...
> > &gt;
> > &gt;
> > &gt; for z = 1 : 21
> > &gt;
> > &gt; A = [-PV_supply -WT_supply -Diesel_supply(z)];
> > &gt;
> > &gt; f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] % how do we manipulate diesel cost?
> > &gt;
> > &gt; b = -Demand;
> > &gt;
> > &gt; [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
> > &gt;
> > &gt;
> > &gt; end
> > &gt;
> > &gt; what I have tried above so far gives me an inconsistent matrix size since I think it is not looping correctly
> > =====================
> >
> >
> > Probably because in this expression
> >
> > A = [-PV_supply -WT_supply -Diesel_supply(z)]
> >
> > you are concatenating 2 vectors with the scalar Diesel_supply(z)
>
> Indeed I have adjusted to
> for z = 1:21
> A= [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];
>
> f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] ;
>
>
> b = -Demand;
>
> [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
>
> end
>
> However, this of course only gives the "Diesel_supply" value for z = 21.
> I need to index the LHS of the A equation, do you know how this is done?
> Thank you

This format


 A(:,:,z) = [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];

only gives to z = 2 - Is this because it attempts to code in a 3 dimensional format?

Subject: Implicit function within linprog for loop

From: Matt J

Date: 11 Jul, 2012 20:32:12

Message: 34 of 36

Andrew Alkiviades <andrew.alkiviades@gmail.com> wrote in message <81a8715a-2635-414b-953d-d51d67898ff3@googlegroups.com>...
>
> This format
>
>
> A(:,:,z) = [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];
>
> only gives to z = 2 - Is this because it attempts to code in a 3 dimensional format?


Hmmm. I don't see why this line of code would give you an error for any z>=1...

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 20:34:40

Message: 35 of 36

The optimisation works with


Diesel_matrix = xlsread('test_diesel.xlsx','Sheet2');

Diesel_supply = Diesel_matrix(:,1); % Power output of diesel generator

hourly_cost = Diesel_matrix(:,2); % Diesel cost of running genreator at that output


        
 for z = 1:size(Diesel_matrix,1)
     
 A = [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];
 
   f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] ;

 
 b = -Demand;
 
 [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)

 end

However, the matrix A only includes Diesel_supply values of 200, which is the last value of the predetermined matrix

Subject: Implicit function within linprog for loop

From: Andrew Alkiviades

Date: 11 Jul, 2012 21:53:40

Message: 36 of 36

On Wednesday, 11 July 2012 21:34:40 UTC+1, Andrew Alkiviades wrote:
> The optimisation works with
>
>
> Diesel_matrix = xlsread('test_diesel.xlsx','Sheet2');
>
> Diesel_supply = Diesel_matrix(:,1); % Power output of diesel generator
>
> hourly_cost = Diesel_matrix(:,2); % Diesel cost of running genreator at that output
>
>
>
> for z = 1:size(Diesel_matrix,1)
>
> A = [-PV_supply -WT_supply ones(24,1).*-Diesel_supply(z)];
>
> f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(z))] ;
>
>
> b = -Demand;
>
> [x,fval,exitflag] = linprog(f,A,b,[],[],lb,ub)
>
> end
>
> However, the matrix A only includes Diesel_supply values of 200, which is the last value of the predetermined matrix

With the code in me previous post - I can run the optimisation for 21 sets of x's (which is equal to the number of loops I am trying to do)
therefore what remains is to make sure that for each row in A for the diesel_supply column, the cell is going from z = 1 to 21

also, in the "f" vector


   f = [CRF_PV*CC_PV; CRF_WT*CC_WT; (CRF_Diesel_generator*CC_Diesel)+sum(hourly_cost(1:z))] ;

I am trying to code so that in row 3, the +sum(hourly_cost(1:z)) component is not multiplied by x3, i.e is not considered a coefficient of x3, but is added onto CRF_Diesel_generator*CC_Diesel * x3

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us