The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
'Break' in RepeatUntilOperatorChain operator.
Hi,
This question is with regard to the RepeatUntilOperatorChain operator. As I understand this operator can do a task for a certain iterations and also for some timeout.
Now, I want to perform certain operations for random number of times. So, I set the max_iteraions parameter to be say 100. In one run i need only say 15 iterations and in another run i may need say 3 iterations etc. Suppose that i got the result at say 5th iteration. Then, i need to terminate the loop, instead of carrying till 100 iterations. How do i do this? Is there any other operator which can do the same job?
I herewith give an example.
Actually in the above code in each iteration, i will change the macro value k. And I terminate for k, which has satifactory results. So, how to break the loop after certain condition is met?
Thanks, Shubha
This question is with regard to the RepeatUntilOperatorChain operator. As I understand this operator can do a task for a certain iterations and also for some timeout.
Now, I want to perform certain operations for random number of times. So, I set the max_iteraions parameter to be say 100. In one run i need only say 15 iterations and in another run i may need say 3 iterations etc. Suppose that i got the result at say 5th iteration. Then, i need to terminate the loop, instead of carrying till 100 iterations. How do i do this? Is there any other operator which can do the same job?
I herewith give an example.
<operator name="Root" class="Process" expanded="yes">
<operator name="ExampleSetGenerator (3)" class="ExampleSetGenerator">
<parameter key="target_function" value="spiral cluster"/>
<parameter key="number_of_attributes" value="2"/>
</operator>
<operator name="RepeatUntilOperatorChain" class="RepeatUntilOperatorChain" expanded="yes">
<parameter key="max_iterations" value="5"/>
<operator name="SingleMacroDefinition" class="SingleMacroDefinition">
<parameter key="macro" value="k"/>
<parameter key="value" value="10"/>
</operator>
<operator name="LOFOutlierDetection (2)" class="LOFOutlierDetection">
<parameter key="minimal_points_lower_bound" value="%{k}"/>
<parameter key="minimal_points_upper_bound" value="%{k}"/>
</operator>
<operator name="IOStorer" class="IOStorer">
<parameter key="name" value="Mydata"/>
<parameter key="io_object" value="ExampleSet"/>
<parameter key="remove_from_process" value="false"/>
</operator>
</operator>
<operator name="IORetriever" class="IORetriever">
<parameter key="name" value="Mydata"/>
<parameter key="io_object" value="ExampleSet"/>
</operator>
</operator>
Actually in the above code in each iteration, i will change the macro value k. And I terminate for k, which has satifactory results. So, how to break the loop after certain condition is met?
Thanks, Shubha
0
Answers
and how do you determine if the results are satisfactory?
Regards,
Tobias
Thanks, Shubha
Just wanted to share that I got resolved this in a different way...
Actually, my loop had the CommandLineOperator which takes user inputs in the beginning of the loop and at the end of the loop, the user can see the results of the parameter he has put. So, the question was if I had set the MaximumIterations to 100, and if i got the result at say 5th iteration, i need to continue entering for the user input for rest 95 iterations. I wanted to avoid these 95 loops being getting executed. This was my worry.
So, the solution was I put this operator "RepeatUntilOperatorChain" inside the very helpful operator, "ExceptionHandling". So, once the user sees that he got his result in the 5th iteration, coming to the 6th iteration he can input an invalid input (in my case a character), so that the loop stops at that point because of the "ExceptionHandling" operator and starts executing the operators which are after the loop. I really have to thank this "ExceptionHandling Operator". (Yes, I need to confirm that it doesn't overhandle the other errors.)
But felt like, there should have been a do-while loop still...or dont know... but, I am very happy today...
Thanks,
Shubha Karanth