@@ -143,35 +143,22 @@ namespace geode
143143 double statistic ( const ObjectSets< ObjectType >& state ) const override
144144 {
145145 double sum = 0.0 ;
146- this ->for_each_targeted_object ( state, [&]( const ObjectId&
147- obj_id ) {
148- const auto & cur_obj = state.get_object ( obj_id );
149- const auto neighbors =
150- state.get_all_object (); // state.neighbors( obj_id, 1.1 );
151- for ( const auto & neigh_obj_id : neighbors )
152- {
153- // if( neigh_obj_id.set_id < obj_id.set_id )
154- // {
155- // continue;
156- // }
157- // if( neigh_obj_id.set_id == obj_id.set_id
158- // && neigh_obj_id.index <= obj_id.index )
159- // {
160- // continue;
161- // }
162-
163- if ( neigh_obj_id == obj_id )
164- {
165- continue ;
166- }
146+ this ->for_each_targeted_object (
147+ state, [&]( const ObjectId& obj_id ) {
148+ const auto & cur_obj = state.get_object ( obj_id );
167149 ObjectRef< ObjectType > object{ cur_obj, obj_id.set_id };
168- ObjectRef< ObjectType > neigh_object{
169- state.get_object ( neigh_obj_id ), neigh_obj_id.set_id
170- };
150+ const auto neighbors = state.neighbors ( obj_id,
151+ interaction_->neighborhood_searching_distance () );
152+ for ( const auto & neigh_obj_id : neighbors )
153+ {
154+ ObjectRef< ObjectType > neigh_object{
155+ state.get_object ( neigh_obj_id ),
156+ neigh_obj_id.set_id
157+ };
171158
172- sum += interaction_->evaluate ( object, neigh_object );
173- }
174- } );
159+ sum += interaction_->evaluate ( object, neigh_object );
160+ }
161+ } );
175162 return sum / 2 .;
176163 }
177164
0 commit comments