I have given up the approach with the permutations since it seems like a dead end. I'm working on a different approach now.
Type: Posts; User: andreas90
I have given up the approach with the permutations since it seems like a dead end. I'm working on a different approach now.
As I said in my previous post this will effect the computational time of the program.
In each run of the algorithm, the method that creates the permutations is called many times. Therefore the...
Thanks for your suggestion.
Unfortunately, at some point I'll need all the permutations together in the ArrayList to do some stuff with them, so the exception may be avoided when I'm generating them...
Unfortunately I need the combinations/permutations themselves. Finding the number of them was a "trick" to improve the time and memory usage. ie using an ArrayList with initial size (which is the...
You are welcome.
Each time you call the readLine() method a line in your text file is read.
Your text file is:
and your code:
try {
while((r.readLine())!=null){
Hello aesguitar!
You are right about my RAM, it's 3GB. As you can see from the code I posted I keep the permutations, not combinations. My new approach involves finding the combinations (which are...
Hello beer-in-box!
It's pretty simple what is wrong with your code.
try {
while((r.readLine())!=null){
w = r.readLine();
System.out.println(w);
Hello Z!
Thanks for the time you spent on my problem. I tried calculating P(n,r) as you suggested and it worked as I thought. I don't get a java.lang.OutOfMemoryError exception in the internal...
The number of permutations is P(n,r) = n!/(n-r)!
So for n=60 and r=4 I have P(60,4) = 60! / (60 - 4)! = 11703240 permutations.
I tried the same method with each quadraplet being a String instead...
I didn't explain well what I'm doing. This is the method that causes the java.lang.OutOfMemoryError exception I posted in post#2. I generate P(n,r) permutations which for the following method is...
It should be equal to the number of the permutations , if I'm getting right what you asked.
You mean if I need all the permutations? Yes, I need them because I want to search every possible...
When I try to solve a large instance of the problem I get the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown...
Hello guys!
I'll give you the big picture of what I'm doing. I'm solving a combinatorial optimization problem. I find an initial solution and then try to improve it with some heuristics. One of...
Hello EatMyBible!
You are right. You need to somehow use the input to make your calculations.
Since the input is in [0,10) and your array has length 10, you can use input as the index of the...
Καλωσήρθες! Ψάχνω καιρό για Έλληνα στο φορουμ. Και ό,τι θες στείλε και προσωπικό μήνυμα αν μπορώ να βοηθήσω, αν και υπάρχουν πολύ πιο καταρτισμένα άτομα από μένα και σίγουρα μπορούν να βοηθήσουν...
That's true. A side note, if I were interested in a career as a software engineer in Greece, I would definitely spent time learning C# and the .NET framework since it is very very popular in...
Hello Evilreaper!
The error message is pretty clear. You should initialize that variable. And another think I noticed:
if( PaymentTerm == CREDIT )
You should use the String's equals...
Hello loui345!
I have very little experience with Apache Poi and just tried your code with the same results as yours. But this stackoverflow thread and the Apache Poi Busy Developers' Guide seem...
Yoe are welcome. I would try a HashMap with the regular words as keys and the encrypted ones as values. Read the link for further information.
The "encrypted" word is set inside every if statement. I talk about the statement
jtfResult.setText(display + "" + "" + ""); which is BEFORE the if statements.
The way it is your code now when the...
Did you print what is being tested (ie jtfResult.getText())?
What is the purpose of the statement
jtfResult.setText(display + "" + "" + "");
Why don't you test directly the textfield's text?
I can see two problems in your code. Firstly, you didn't follow my hint in post #2. Your if statements are wrong. They don't have an error but the semicolon in the end of them is a logic error. Try...
Can you show the code you tried? Or better a sample of it that shows the problem and can be executed without errors?
Hello maxattack!
You have some logic errors (probably by mistake).
if (jtfResult.getText().equals("d"));
.
.
.
Hello Mike!
Yes, you are correct. You must return a value of that type. There is no way you can avoid that - as far as I know.
A common way to handle this situation is to have some "default"...