How to model my constraint in a more short and professional manner

Dear,

I have a set in the model of my optimization problem that changes from i=1 to i=144. So I wrote the line below to describe it:

Set ‘index’ /i1*i144/;

Now I have a linear constraint that says:

MyConstraint: X(i+1)-X(i)<Delta

Where X is a continuous variable.

I can write it down for i=1 to i=144 and form a matrix but this method does not make sense because there will be a big matrix (144*144) in your code which makes your code look amateurish. I am looking for a better way to describe My Constraint.
It would be really appreciative if someone help me do that in a professional manner.

Hi Mahdi
I did not notice you mean exactly. if you want to write a indexed constraint try this one;

Equations
con01;

con01(i)$(ord(i) wrote:

Dear,

I have a set in the model of my optimization problem that changes from i=1 to i=144. So I wrote the line below to describe it:

Set ‘index’ /i1*i144/;

Now I have a linear constraint that says:

MyConstraint: X(i+1)-X(i)<Delta

Where X is a continuous variable.

I can write it down for i=1 to i=144 and form a matrix but this method does not make sense because there will be a big matrix (144*144) in your code which makes your code look amateurish. I am looking for a better way to describe My Constraint.
It would be really appreciative if someone help me do that in a professional manner.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

hi thanks, it works.

در شنبه 7 نوامبر 2015، ساعت 22:53:49 (UTC+3:30)، Ali Reza Bahari نوشته:

Hi Mahdi
I did not notice you mean exactly. if you want to write a indexed constraint try this one;

Equations
con01;

con01(i)$(ord(i) wrote:

Dear,

I have a set in the model of my optimization problem that changes from i=1 to i=144. So I wrote the line below to describe it:

Set ‘index’ /i1*i144/;

Now I have a linear constraint that says:

MyConstraint: X(i+1)-X(i)<Delta

Where X is a continuous variable.

I can write it down for i=1 to i=144 and form a matrix but this method does not make sense because there will be a big matrix (144*144) in your code which makes your code look amateurish. I am looking for a better way to describe My Constraint.
It would be really appreciative if someone help me do that in a professional manner.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.