Parameters values

Hi everyone!!!

In need to know if it is possible to define one parameter with
different values. For example, I need to run my solve statement in a
loop with 4 iterations, however for each loop iteration, parameter “x”
must be initialized with different values. Furthermore, I need to
initialize in iteration 2, 3 and 4 some variables with the values
obtained in the previous ones. Can some one help me with that???

Regards
Sérgio

\

Hi Sergio

You can define your parameter over your set of iterations

set iter /iter1*iter4/;

parameter
myparameter(iter) Parameter that changes in each iteration;

myparameter(“iter1”) = 4;
etc.

Loop(iter,
Mymodelparameter = myparameter(iter);
Solve mymodel;
);


The other problem you can solve by defining a second parameter and change its value after the solve

Parameter
Myparameter2 Parameter that changes after solve;

  • Initialize the parameter for the first loop

Myparameter2 = 2;

Loop(iter,
Solve mymodel;

  • Set the value of myparameter2 to the solution for the variable X
    Myparameter2 = X.L
    );


    Cheers

Renger

-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Sérgio
Sent: Monday, June 04, 2012 1:02 PM
To: gamsworld
Subject: Parameters values

Hi everyone!!!

In need to know if it is possible to define one parameter with different values. For example, I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter “x”
must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

Regards
Sérgio


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

Hi!!

Thanks for the reply. One more question please. What do you mean with Mymodelparameter = myparameter(iter); in the loop statement? Mymodelparameter is not defined anywhere.

cheers

Sérgio

2012/6/4 Renger van Nieuwkoop

Hi Sergio

You can define your parameter over your set of iterations

set iter /iter1*iter4/;

parameter
myparameter(iter) Parameter that changes in each iteration;

myparameter(“iter1”) = 4;
etc.

Loop(iter,
Mymodelparameter = myparameter(iter);
Solve mymodel;
);


The other problem you can solve by defining a second parameter and change its value after the solve

Parameter
Myparameter2 Parameter that changes after solve;

  • Initialize the parameter for the first loop

Myparameter2 = 2;

Loop(iter,
Solve mymodel;

  • Set the value of myparameter2 to the solution for the variable X
    Myparameter2 = X.L
    );


    Cheers

Renger

-----Original Message-----
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Sérgio
Sent: Monday, June 04, 2012 1:02 PM
To: gamsworld
Subject: Parameters values

Hi everyone!!!

In need to know if it is possible to define one parameter with different values. For example, I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter “x”
must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

Regards
Sérgio


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

That would be the exogeneous parameter in your Model equations that changeant in the Loop. For example a tax Rate that is changed in every Loop and does not depend on the Model Solution.
Renger

Sent from my iPhone

Am 05.06.2012 um 12:28 schrieb “Sérgio Pereira” :

Hi!!

Thanks for the reply. One more question please. What do you mean with Mymodelparameter = myparameter(iter); in the loop statement? Mymodelparameter is not defined anywhere.

cheers

Sérgio

2012/6/4 Renger van Nieuwkoop

Hi Sergio

You can define your parameter over your set of iterations

set iter /iter1*iter4/;

parameter
    myparameter(iter)   Parameter that changes in each iteration;

myparameter("iter1") = 4;
etc.

Loop(iter,
   Mymodelparameter = myparameter(iter);
    Solve mymodel;
);


The other problem you can solve by defining a second parameter and change its value after the solve

Parameter
   Myparameter2    Parameter that changes after solve;

* Initialize the parameter for the first loop

Myparameter2 = 2;

Loop(iter,
      Solve mymodel;
* Set the value of myparameter2 to the solution for the variable X
      Myparameter2 = X.L
);


Cheers

Renger

-----Original Message-----
From: <gamsworld@googlegroups.com> [mailto:<gamsworld@googlegroups.com>] On Behalf Of Sérgio
Sent: Monday, June 04, 2012 1:02 PM
To: gamsworld
Subject: Parameters values

Hi everyone!!!

In need to know if it is possible to define one parameter with different values. For example,  I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter "x"
must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

Regards
Sérgio

--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

I have write the code as you told me and it seems to work fine until model achieves iteration 32. After that algorithm stops without finding any solution reporting this:

AlphaECP: MIP solver failed, status 5

Do you know what it means?

Sérgio

2012/6/5 Renger van Nieuwkoop

That would be the exogeneous parameter in your Model equations that changeant in the Loop. For example a tax Rate that is changed in every Loop and does not depend on the Model Solution.
Renger

Sent from my iPhone

Am 05.06.2012 um 12:28 schrieb “Sérgio Pereira” :

Hi!!

Thanks for the reply. One more question please. What do you mean with Mymodelparameter = myparameter(iter); in the loop statement? Mymodelparameter is not defined anywhere.

cheers

Sérgio

2012/6/4 Renger van Nieuwkoop

    Hi Sergio

    You can define your parameter over your set of iterations

    set iter /iter1*iter4/;

    parameter
        myparameter(iter)   Parameter that changes in each iteration;

    myparameter("iter1") = 4;
    etc.

    Loop(iter,
       Mymodelparameter = myparameter(iter);
        Solve mymodel;
    );


    The other problem you can solve by defining a second parameter and change its value after the solve

    Parameter
       Myparameter2    Parameter that changes after solve;

    * Initialize the parameter for the first loop

    Myparameter2 = 2;

    Loop(iter,
          Solve mymodel;
    * Set the value of myparameter2 to the solution for the variable X
          Myparameter2 = X.L
    );


    Cheers

    Renger

    -----Original Message-----
    From: <gamsworld@googlegroups.com> [mailto:<gamsworld@googlegroups.com>] On Behalf Of Sérgio
    Sent: Monday, June 04, 2012 1:02 PM
    To: gamsworld
    Subject: Parameters values

    Hi everyone!!!

    In need to know if it is possible to define one parameter with different values. For example,  I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter "x"
    must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

    Regards
    Sérgio

    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Sorry, i am no expert in Mip
Renger

Sent from my iPhone

Am 05.06.2012 um 16:10 schrieb “Sérgio Pereira” :

I have write the code as you told me and it seems to work fine until model achieves iteration 32. After that algorithm stops without finding any solution reporting this:

AlphaECP: MIP solver failed, status 5

Do you know what it means?

Sérgio

2012/6/5 Renger van Nieuwkoop

That would be the exogeneous parameter in your Model equations that changeant in the Loop. For example a tax Rate that is changed in every Loop and does not depend on the Model Solution.
Renger

Sent from my iPhone

Am 05.06.2012 um 12:28 schrieb "Sérgio Pereira" :
Hi!!

Thanks for the reply. One more question please. What do you mean with Mymodelparameter = myparameter(iter); in the loop statement? Mymodelparameter is not defined anywhere.

cheers

Sérgio

2012/6/4 Renger van Nieuwkoop

    Hi Sergio

    You can define your parameter over your set of iterations

    set iter /iter1*iter4/;

    parameter
        myparameter(iter)   Parameter that changes in each iteration;

    myparameter("iter1") = 4;
    etc.

    Loop(iter,
       Mymodelparameter = myparameter(iter);
        Solve mymodel;
    );


    The other problem you can solve by defining a second parameter and change its value after the solve

    Parameter
       Myparameter2    Parameter that changes after solve;

    * Initialize the parameter for the first loop

    Myparameter2 = 2;

    Loop(iter,
          Solve mymodel;
    * Set the value of myparameter2 to the solution for the variable X
          Myparameter2 = X.L
    );


    Cheers

    Renger

    -----Original Message-----
    From: <gamsworld@googlegroups.com> [mailto:<gamsworld@googlegroups.com>] On Behalf Of Sérgio
    Sent: Monday, June 04, 2012 1:02 PM
    To: gamsworld
    Subject: Parameters values

    Hi everyone!!!

    In need to know if it is possible to define one parameter with different values. For example,  I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter "x"
    must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

    Regards
    Sérgio

    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thanks anyway!! You have already helped me a lot.

Sérgio

2012/6/5 Renger van Nieuwkoop

Sorry, i am no expert in Mip
Renger

Sent from my iPhone

Am 05.06.2012 um 16:10 schrieb “Sérgio Pereira” :

I have write the code as you told me and it seems to work fine until model achieves iteration 32. After that algorithm stops without finding any solution reporting this:

 AlphaECP: MIP solver failed, status 5

Do you know what it means?

Sérgio

2012/6/5 Renger van Nieuwkoop

    That would be the exogeneous parameter in your Model equations that changeant in the Loop. For example a tax Rate that is changed in every Loop and does not depend on the Model Solution.
    Renger

    Sent from my iPhone

    Am 05.06.2012 um 12:28 schrieb "Sérgio Pereira" :
    Hi!!

    Thanks for the reply. One more question please. What do you mean with Mymodelparameter = myparameter(iter); in the loop statement? Mymodelparameter is not defined anywhere.

    cheers

    Sérgio

    2012/6/4 Renger van Nieuwkoop

        Hi Sergio

        You can define your parameter over your set of iterations

        set iter /iter1*iter4/;

        parameter
            myparameter(iter)   Parameter that changes in each iteration;

        myparameter("iter1") = 4;
        etc.

        Loop(iter,
           Mymodelparameter = myparameter(iter);
            Solve mymodel;
        );


        The other problem you can solve by defining a second parameter and change its value after the solve

        Parameter
           Myparameter2    Parameter that changes after solve;

        * Initialize the parameter for the first loop

        Myparameter2 = 2;

        Loop(iter,
              Solve mymodel;
        * Set the value of myparameter2 to the solution for the variable X
              Myparameter2 = X.L
        );


        Cheers

        Renger

        -----Original Message-----
        From: <gamsworld@googlegroups.com> [mailto:<gamsworld@googlegroups.com>] On Behalf Of Sérgio
        Sent: Monday, June 04, 2012 1:02 PM
        To: gamsworld
        Subject: Parameters values

        Hi everyone!!!

        In need to know if it is possible to define one parameter with different values. For example,  I need to run my solve statement in a loop with 4 iterations, however for each loop iteration, parameter "x"
        must be initialized with different values. Furthermore, I need to initialize in iteration 2, 3 and 4 some variables with the values obtained in the previous ones. Can some one help me with that???

        Regards
        Sérgio

        --
        To post to this group, send email to <gamsworld@googlegroups.com>.
        To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
        For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

        --
        To post to this group, send email to <gamsworld@googlegroups.com>.
        To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
        For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
    --
    To post to this group, send email to <gamsworld@googlegroups.com>.
    To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


--
To post to this group, send email to <gamsworld@googlegroups.com>.
To unsubscribe from this group, send email to <gamsworld+unsubscribe@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.