Solved

cycle do

  • 26 September 2019
  • 5 replies
  • 134 views

Dear all,

I want to create a cycle for-do and I want to have the values of the results for each considered point.

How can I write this in aimms?



For now I wrote this



for e| (epsilon_e(e))>epsilonl and (epsilon_e(e))

CO2_ec:=epsilon_e(e);

solve Min_Total_Costs;

Total_Costs_e(e):=Total_Costs;

endfor;



with e the index of a set epsilon_e, while Total_Costs_e(e) a variable.

I want to know the value of Total_Costs_e for each e. What is missing in the code?

Thanks

Best

GL
icon

Best answer by Chris Kuip 27 September 2019, 07:52

View original

5 replies

Userlevel 5
Badge +7
* Perhaps a typo: at the end of the first line (starting with for) I would expect the word "do".

* Looking at your code, I expect the following identifiers to be declared as parameters:


  • epsilonl
  • epsilon_e
  • CO2_ec
  • Total_Costs_e
* And I expect Total_Costs to be declared as a variable and this variable is solved in the mathematical program Min_Total_Costs.



Also note that if epsilonl is strictly positive (as its name suggests) then the "and (epsilon_e(e))" part of the condition on the for loop is superfluous.
Dear @Chris Kuip ,

thanks for your response. I tried and it still is not working. How can I define the set for index e and these parameters?

Thanks.
Dear @Chris Kuip

how can define the number of points for the defined range epsilon?

Thanks
Userlevel 5
Badge +7
The set that is the range of index e can be declared as follows (where p_NumberOfPoints controls the set size):

code:
  Parameter p_NumberOfPoints {
InitialData: 3;
}
Set s_Events {
SubsetOf: Integers;
Index: e;
Definition: ElementRange(1,p_NumberOfPoints);
}
dear @Chris Kuip

thanks, it seems that I obtained some results for each considered point.

Many tanks.

Best

GL

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator