Skip to content

Commit

Permalink
Igor Rodionov counter added
Browse files Browse the repository at this point in the history
  • Loading branch information
DDred committed Sep 19, 2011
1 parent 8c5b705 commit b090293
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package libiada.IntervalAnalysis.Buildings.Counter;

public class BuildingCountLimitAlphabet extends BuildingsCount{
public BuildingCountLimitAlphabet() {
}

protected double f(int l, int m, int s) {
if (l + s <= m) {
return 0;
}
return super.f(l, m, s);
}
}
34 changes: 34 additions & 0 deletions src/libiada/IntervalAnalysis/Buildings/Counter/BuildingsCount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package libiada.IntervalAnalysis.Buildings.Counter;

/**
* Created by IntelliJ IDEA.
* User: goruha
* Date: 9/19/11
* Time: 10:45 PM
* To change this template use File | Settings | File Templates.
*/
public class BuildingsCount {
protected double f(int l, int m, int s) {
if (l < 1 || m < s) {
return 0;
}

if (l == 1) {
return 1;
}

double temp = 0;
for (int i = 1; i <= s + 1; i++) {
temp += f(l - 1, m, Math.max(s, i));
}
return temp;
}

public double getBuildingsCount(int l, int m) {
return this.f(l, m, 1);
}

public double getProbability(int l, int m, int s, int s_parent) {
return f(l, m, s)/f(l+1, m, s_parent);
}
}

0 comments on commit b090293

Please sign in to comment.