constraint error 'int' object is not subscriptable

18 views
Skip to first unread message

Giuseppe Squillace

unread,
May 13, 2019, 8:38:42 AM5/13/19
to Pyomo Forum
Hi I've this constraint :
        
         def v15(model,j1,j2):
         if(j1<j2) and d[j1]==d[j2]): return riga[j1]<=riga[j2]
         else: return Constraint.Skip
    model.v15=Constraint(model.pazienti,model.pazienti,rule=v15)

where riga is a PositiveIntegers variable and model.pazienti is a RangeSet.

And python return me this error, that I don't know how to fix:

 'int' object is not subscriptable 

Thanks for replies.

Nicholson, Bethany L.

unread,
May 13, 2019, 10:04:24 AM5/13/19
to pyomo...@googlegroups.com

What are the types of ‘d’ and ‘riga’? Are they singletons or lists? Are they Pyomo components or native Python types?

 

Bethany

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/34a710ef-2506-438c-b631-54060fea2b93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages