C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

what's the design pattern for trial-fail-modify-retry

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
John Black
Guest





PostPosted: Fri Mar 05, 2004 11:45 pm    Post subject: what's the design pattern for trial-fail-modify-retry Reply with quote



Hi,
I am wondering what's the best design pattern for such task: There
are some requirement for resource allocation scheme, the requirements
are not equally important, in another words, when it is impossible to
meet all the requirements, some of them can be discarded, this process
can repeat again and again until a satisfied solution is found.
This is basically trial-fail-adjust-retry, is there a pattern like
this?
Is there a pattern for managing layered requirements?

Thanks.

Back to top
H. S. Lahman
Guest





PostPosted: Sun Mar 07, 2004 10:16 pm    Post subject: Re: what's the design pattern for trial-fail-modify-retry Reply with quote



Responding to Black...

Quote:
I am wondering what's the best design pattern for such task: There
are some requirement for resource allocation scheme, the requirements
are not equally important, in another words, when it is impossible to
meet all the requirements, some of them can be discarded, this process
can repeat again and again until a satisfied solution is found.
This is basically trial-fail-adjust-retry, is there a pattern like
this?
Is there a pattern for managing layered requirements?

Not really. Resource allocation is basically an algorithmic problem.
It will probably be encapsulated in a method someplace and the best you
can hope for is to organize the data in an optimal fashion for the
algorithm. That will depend on the specific algorithm.

For example, one possibility is:
* prunes to one
[Resource] ----------------+
Quote:
* |
initially selects from | |
|
* critical for 1 | 1 1 |

[Requirement] ----------------------- [Allocator] ---------------+
Quote:
* | 1
| optional for
|
+-------------------------------------+


This allows you to resolve the critical requirements first by navigating
that collection and then try to deal with the less critical requirements
by navigating the optional collection. Alternatively,

* prunes to one
[Resource] ---------------+
Quote:
* |
initially selects from | |
|
|
* allocates 1 | 1 1 |

[Requirement] ------------------------ [Allocator] --------------+
<ordered>

can be used if an absolute priority scheme is employed by the algorithm.

Note that both of these schemes assumes [Allocator] maintains a
temporary list of [Resources] that it prunes as requirements are
evaluated so that the list contains only [Resources] that satisfy all of
the [Requirements] processed thus far. That, in itself, defines much of
the resource allocation algorithm. B-) So if one chose a different
solution algorithm, one would need -- at a minimum -- different
relationships.

*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
[email]hsl (AT) pathfindermda (DOT) com[/email]
Pathfinder Solutions -- Put MDA to Work
http://www.pathfindermda.com
(888)-OOA-PATH





Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.