Ecology C++ Code [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
New to C++ and stuck on how to start coding this problem which is an Ecology question at first to start a cell with plants antelopes and tigers. Based on initial population, birth rates, food supply, dying off and migration into other cells (once 1 cell is discovered then can expand more). Did some tests on paper to see that plants are going to need a Cap because plants multiply more than antelopes can eat them. I dont really know how to start this if anyone can give me a starting point then that will be grateful.
Thank you.

I sounds like you're trying to build an individual, agent-based, or microscale model: this being subsets of the more general topic of discrete event simulation. Looking into those topics and reading some of the literature and books around them would be a good start.
One way to get started conceptually might be to play with SimPy. Once you think you understand how its pieces fit together and how to build a model, you'll be in a better position to move to a higher-performance language, like C++, where you'll need to build more of the components yourself.
You should also learn how to program. Having to ask a question as general as you are at the beginning of this endeavour should give you pause: people have devoted careers figuring out how to do this the right way. That said: C++ is a decent choice of language because you'll need to run your model not just once, but tens of thousands of times, in order to get an idea of how variable your results are. Remembering that the number of interactions between variables grows exponentially in the number of variables, you'll also want to explore different combinations of environments with an eye to testing the strength of your assumptions.
All of this will also probably require the use of a high-performance environment: you'll want to learn about MPI, R's HPC packages, jug, or Spark: each of which would have to be tamed to work with your implementation of the model.
This paper I recently published has a relatively simple agent-based model, along with an analysis and source code, which might help you get started. It may also help you understand the enormity of the undertaking you propose.

Related

How do I compare two functions' speed and performance [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have two functions performing same process but with different techniques and I need to know on a large scale which technique is faster than the other of maybe in the future will be more techniques available. So my question is, how can I do that in c++ specially? Is there a specific method and header to be used to perform this task?
More details:
For example the isLargest() uses three parameters and it has two versions, one uses a nested if technique and the other uses initializers and less if statements. So if I need to know which one is faster, how can I do that?
Try your code in the real world and measure
There is a tool called a profiler that is meant to solve this problem. Broadly speaking, there are two kinds (note: some are a mix between the two):
Sampling profilers.
Instrumenting profilers.
It's worth learning about what each does and their pros/cons, but if you don't know what to use go with a sampling profiler.
There are many sampling profilers, but support depends on your platform. If you're on Windows, Visual Studio comes with a really nice sampling profiler and I recommend you start there!
If you go down this route, it's important to make sure you use your functions as you would "for real" when you're profiling them, as there are many subtle factors that can affect the result.
An alternative
If you don't want to try your code running in a real program, perhaps if you're just trying to understand general characteristics of the function, there are libraries to help you do this such as Google Benchmark.
Benchmarking code can be surprisingly difficult to get right, so I would strongly recommend using existing benchmarking tools where like Google Benchmark wherever possible.

The importance of estimation [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm a beginner in programming and I'm studying C++ using Programming principles and practice using C++. Today Now I'm studying the chapter about the errors and in one paragraph the author explains the importance of estimation, but I have a problem because I cannot understand why estimation ( remember that I have just 2 months of experience in programming ) is so important.
Let me explain in a better way :
To give me an example of estimation the author makes an example where we have to imagine that he wrote a program that calculates the driving distance between two cities, and we want to know whether a given value is reasonable, for example: is a reasonable driving time of 15 hours between New York and Denver? Obviously to come to a conclusion we need to know the distance (looking on the web) between New York and Denver.
My question is: why can not we just check on the web if the result of our program is that correct? Why make estimates appears to be so important? Why the author states that make estimates can avoid us a lot of wasted time and confusion?
Because sometimes you cannot look things up on the web. Imagine a sales management app that calculates the discount on a sale. You cannot google that to find the answer. But if you write the app and it returns a discount of 10,000,000$ on an order of 100$ then that's probably wrong.
What he is really saying is that you will write much better programs if you understand the problem domain, ie you understand what its supposed to do
Imagine being asked to write a program that computes the frunk ratio of the splidge grouters given that each froop has 12 enzags. Is 42 a good answer? Many times I have seen devs in this situation - they have 0 idea of what the program is actually doing and so cant tell if they are writing junk

AI for time table generator software [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to develop a time table generator software for my college. Obviously it requires a great deal of constraint satisfaction i.e. I need to satisfy a lot of rules in order to generate a bunch of time tables where classes do not clash. After doing some research and reading this article, I feel I need to use some AI in it. Now, I am a complete newbie to AI. Can anyone tell me which algorithm will work best in my case?
The simplest algorithm that you can use for this problem is genetic algorithm (or any other evolutionary algorithm). Solving this problem using GA is very simple but yet effective. There are lots of papers and codes that have used this approach for this problem.
If you have few rules and constraints, you may want to use exact straightforward techniques like backtracking with CSP heuristics to speed it up, but if there are lots of classes and constraints, I suggest Genetic Algorithm.
Well, not a trivial task indeed. Problems like this one are VERY hard to solve.
Here I can recommend you two things:
Use an existing CSP/COP solver and describe your constraints in its language. These solvers are very good, fast and tuned, being developed for years.
Educate yourself in the area of Discrete Optimization (there was a course at coursera.org with the same name which was great). Only after you grasp the basics of how these things work can you try to write your own solver. But let you be warned! Discrete optimization is pain and suffering :-).
This is by no means a suitable place to just tell you how CSP/COP works. It is a very broad and difficult field.
I wish you good luck!

What can a second year computer undergrad do which might be considered worthwhile in the future? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Besides taking classes I mean. I want to make myself stand out from the crowd. I am very good at building logic/algorithms. Like I can implement any problem in C. But I don't know how to harness it! Like what to code!?!
All I have made upto this point is games that too in C's console, using ASCII and character arrays. Snake, Sudoku (making a puzzle and solving too), rip-off of Mario Bros., tictactoe with AI. But making games won't get me anywhere.
I was wondering if I could get suggestions from you guys?
I know C++/C and a little Java. I have just got started with data structures. So, it would be great if it would be relevant to data structures. I know about most trees and types of data structures. Thanks a lot for your help.
I know it's off topic but I have nowhere else to turn to.
Pay attention in your finite automata classes. Learning the basis of all languages makes "knowing" a language irrelevant.
If your school offers it, take some business computer systems classes.
Try to get some project management experience under your belt. This could be done by doing work for charity or an internship for a prof.
Of course there is always open source projects as well.
Get a job. I was working for a small development shop as a second year student.
Open your own company, and start doing some mobile apps. The sky is the limit.
If you want to have long term impact, you can do one of two things:
Be a genius, and invent a new gizmo everybody needs. [Extra points].
Build a foundation for something. Add to it cleanly, continuously. Eventually it will have enough mass to have an impact.

Junior Software Engineer (C++) Interview Advice [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
Hey guys.Tomorrow I have a phone interview with a good company for a Junior Software Engineer position. I have been out of the university with a bachelors for 3 months now, and am a bit rusty on my C++, as it has been a few semesters since I worked with it. I am currently reviewing it (working on pointers at the moment) to be prepared for tomorrow. Below is the description of the job. What would people recommend I brush up on the most to be prepared for the interview? What type of questions do you think the interviewer would ask that I should be sure to be prepared for? Thanks much. This would be huge for me.
Responsibilities
Willingness to accept new challenges and learn on the job in a fast paced environment
Opportunity to become heavily involved in all phases of the development cycle in a very short time period
You will gain hands on experience from day one while working in conjunction with other developers to ensure a high level of quality
Through quality testing and real world feedback, continuously improve the software*s functionality and performance
Skill Requirements
Bachelor*s degree required in Computer Science/Engineering, or any science/engineering field with relevant programming knowledge
Experience programming in C/C++
Ability and desire to learn quickly and adapt to new technologies
Familiar with polymorphism, memory allocation/de-allocation, and common data structures
C# experience is a plus
Network knowledge is a plus
Knowledge of financial terms is a plus
If your C++ experience is a few university courses and that's a while ago, and if you need to brush up on pointers again, then that means you used to know a few things about C++, but need to learn a lot before you'll be a yearling.
If I were you, I would be open about this. Then it comes down to how much you can convince them that you are a quick learner.
Of course, they might not want to hire someone who's not up to it immediately.
Just admit that you aren't experienced with C++ or C, but that you can handle it well and you've been exposed to it before. Emphasize examples in your past where you have accomplished something that took persistence and learning a new skill/field within a reasonable amount of time. I think most employers don't expect university graduates to be very experienced programmers, just simply fresh new minds. Use that to your advantage.
24 hours is sort of a short notice to start preparing for a technical interview.
Read about what you feel you need the most but I'd suggest to drop it. It's always a good advice to take some easy time before an interview.
Behave naturally and honestly. When they ask you about the things you don't know try to think of the solution but if it doesn't come to you just outline your current ideas and admit you don't know/remember it. It's an important personal quality in our job to be able to admit you don't know everything and ask/look for information instead of persisting in your ignorance.