-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DDred
committed
Sep 19, 2011
1 parent
8c5b705
commit b090293
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/libiada/IntervalAnalysis/Buildings/Counter/BuildingCountLimitAlphabet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
src/libiada/IntervalAnalysis/Buildings/Counter/BuildingsCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |