B u `V@sTddlmZddlmZmZmZddlmZmZm Z m Z m Z d dd Z d d d Z dS)) ComponentSet) ConstraintBlockvalue)is_explicitly_indexed_byget_index_set_exceptis_in_block_indexed_bydeactivate_model_at index_warning:0yE>NTFc Cs|dkr|}t}x|jtddD]}t||s6q&t||rBq&t||}|d} |d} x| D]} | | |} y || } Wn0tk r|stt |j | |swbYnXt | j t | j |kst | jt | j |krb|| qbWq&Wx|jtddD]}t||sqt||r$qt||}|d} |d} x| D]} | | |} || }xh|jtddD]V} t | j t | j |kst | jt | j |krj| |krtd|| qjWqDWqWt|S)aFinds constraints of the model that are implicitly or explicitly indexed by time and checks if they are consistent to within a tolerance at the initial value of time. Args: model: Model whose constraints to check time: Set whose initial condition will be checked tol: Maximum constraint violation t0: Point in time at which to check constraints Returns: List of constraint data objects that were found to be inconsistent. NT)activeZ set_except index_getterz%s has already been visited. The only way this should happen is if the model has nested time-indexed blocks, which is not supported.)firstrZcomponent_objectsrrrrKeyErrorprintr namerbodyupperloweraddrZcomponent_data_objects ValueErrorlist)modeltimeZtolt0 allow_skipsuppress_warningsZ inconsistentconinfoZ non_time_setr Znon_time_indexindexZcondataZblkZblkdatar s  G