Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-07-04T09:39:05Z by VincentBeraudier
waterstyler
waterstyler
2 Posts
ACCEPTED ANSWER

Pinned topic assigning fix values to my variable

‏2013-06-11T16:02:18Z |

Hello

I have this variable-constraint

Iit = sum (k in Facility)(Fkit+ Lkit) for all i,t

If I code this as a constraint I think I am going to get error due to not having value for I(it) as a result I was thinking of coding it as variable after my objective function. 

dvar int I[i in Facility][t in Time] = sum(k in Facility)(F[k][i][t] + L[k][i][t]);

error:can not use dexpe int after dvar int

In AMPL I can use variable instead of constraint by just saying "var I{i in Facility,t in Time} =  sum{k in Facility}(F[k,i,t] + L[k,i,t]);"

Thanks alot
Updated on 2013-06-11T16:02:28Z at 2013-06-11T16:02:28Z by waterstyler
  • VincentBeraudier
    VincentBeraudier
    13 Posts
    ACCEPTED ANSWER

    Re: assigning fix values to my variable

    ‏2013-07-04T09:39:05Z  in response to waterstyler

    you have to either declare a variable array and do the == condition in the constrints block such as:

    <code>

    dvat int I[i in Facility][t in Time];

    subject to{

    forall(i in Facility, t in Time) I[i][j] == sum(k in Facility)(F[k][i][t] + L[k][i][t]);;

    }

    </code>

    or you can declare a decision expression with :

    <code>

    dexpr int I[i in Facility][t in Time] = sum(k in Facility)(F[k][i][t] + L[k][i][t]);

    </code> then use I in constraints block.