Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6155885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:30:53+00:00 2026-05-23T20:30:53+00:00

I have a computational algebra task I need to code up. The problem is

  • 0

I have a computational algebra task I need to code up. The problem is broken into well-defined individuals tasks that naturally form a tree – the task is combinatorial in nature, so there’s a main task which requires a small number of sub-calculations to get its results. Those sub-calculations have sub-sub-calculations and so on. Each calculation only depends on the calculations below it in the tree (assuming the root node is the top). No data sharing needs to happen between branches. At lower levels the number of subtasks may be extremely large.

I had previously coded this up in a functional fashion, calling the functions as needed and storing everything in RAM. This was a terrible approach, but I was more concerned about the theory then.

I’m planning to rewrite the code in C++ for a variety of reasons. I have a few requirements:

  • Checkpointing: The calculation takes a long time, so I need to be able to stop at any point and resume later.
  • Separate individual tasks as objects: This helps me keep a good handle of where I am in the computations, and offers a clean way to do checkpointing via serialization.
  • Multi-threading: The task is clearly embarrassingly parallel, so it’d be neat to exploit that. I’d probably want to use Boost threads for this.

I would like suggestions on how to actually implement such a system. Ways I’ve thought of doing it:

  1. Implement tasks as a simple stack. When you hit a task that needs subcalculations done, it checks if it has all the subcalculations it requires. If not, it creates the subtasks and throws them onto the stack. If it does, then it calculates its result and pops itself from the stack.
  2. Store the tasks as a tree and do something like a depth-first visitor pattern. This would create all the tasks at the start and then computation would just traverse the tree.

These don’t seem quite right because of the problems of the lower levels requiring a vast number of subtasks. I could approach it in a iterator fashion at this level, I guess.

I feel like I’m over-thinking it and there’s already a simple, well-established way to do something like this. Is there one?


Technical details in case they matter:

  • The task tree has 5 levels.
  • Branching factor of the tree is really small (say, between 2 and 5) for all levels except the lowest which is on the order of a few million.
  • Each individual task would only need to store a result tens of bytes large. I don’t mind using the disk as much as possible, so long as it doesn’t kill performance.
  • For debugging, I’d have to be able to recall/recalculate any individual task.
  • All the calculations are discrete mathematics: calculations with integers, polynomials, and groups. No floating point at all.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:30:53+00:00Added an answer on May 23, 2026 at 8:30 pm

    there’s a main task which requires a small number of sub-calculations to get its results. Those sub-calculations have sub-sub-calculations and so on. Each calculation only depends on the calculations below it in the tree (assuming the root node is the top). No data sharing needs to happen between branches. At lower levels the number of subtasks may be extremely large… blah blah resuming, multi-threading, etc.

    Correct me if I’m wrong, but it seems to me that you are exactly describing a map-reduce algorithm.

    Just read what wikipedia says about map-reduce :

    "Map" step: The master node takes the input, partitions it up into smaller sub-problems, and distributes those to worker nodes. A worker node may do this again in turn, leading to a multi-level tree structure. The worker node processes that smaller problem, and passes the answer back to its master node.

    "Reduce" step: The master node then takes the answers to all the sub-problems and combines them in some way to get the output – the answer to the problem it was originally trying to solve.

    Using an existing mapreduce framework could save you a huge amount of time.

    I just google "map reduce C++" and I start to get results, notably one in boost http://www.craighenderson.co.uk/mapreduce/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a computational intensive project that is highly parallelizable: basically, I have a
I have a probability problem, which I need to simulate in a reasonable amount
I have a simple problem: to collect objects into a list and traverse this
I have a computation that can be divided into independent units and the way
I'm taking a course in computational complexity and have so far had an impression
I have an Interface called IStep that can do some computation (See Execution in
Have you guys had any experiences (positive or negative) by placing your source code/solution
I use numpy for numerical linear algebra. I suspect that I can get much
I've read in Wikipedia that neural-network functions defined on a field of arbitrary real/rational
I have to do a final project for my computational linguistics class. We've been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.