public class ErlangCWeb extends Object
ErlangC
as an online program.
The results are formatted in JSON string.
Error messages are also returned as JSON string, see
java.lang.String)
.
This program can evaluate the performance of a waiting queue using Erlang C and also find the required minimum number of servers to satisfy a service level target given in parameter.
Modifier and Type | Class and Description |
---|---|
static class |
ErlangCWeb.ErlangCResults
This class is used to hold the results of an evaluation of Erlang C.
|
static class |
ErlangCWeb.FindMinServers
This subclass is used only to execute the method
java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) . |
Modifier and Type | Method and Description |
---|---|
static String |
getJson(LinkedList<ErlangCWeb.ErlangCResults> results,
TimeUnit waitUnit)
Returns the results in JSON format (String).
|
static String |
getJson(LinkedList<ErlangCWeb.ErlangCResults> results,
TimeUnit waitUnit,
int requiredServers)
Returns the results in JSON format (String) that is the same as
umontreal.iro.lecuyer.ccoptim.web.TimeUnit)
except with an additional value that contains the required number of servers. |
static String |
getJsonMessage(String message,
String msgType)
Returns a message in JSON format.
|
static void |
main(String[] args)
Program to evaluate the performance measure of a queue using the Erlang C formula.
|
static String |
multiEvalErlangC(String arrivalRateP,
String arrivalRateUnitP,
String avgServiceTimeP,
String avgServiceTimeUnitP,
String capacityP,
String numServerP,
String awtP,
String awtUnitP,
String avgWaitTimeUnitP,
String serverRangeP)
Program to evaluate the performance measure of a queue using the Erlang C formula.
|
static String |
multiEvalMinServers(String arrivalRateP,
String arrivalRateUnitP,
String avgServiceTimeP,
String avgServiceTimeUnitP,
String capacityP,
String awtP,
String awtUnitP,
String targetSLP,
String avgWaitTimeUnitP,
String serverRangeP)
Program to find the minimum required number of servers in order to satisfy the service level target,
and then it evaluates the performance measure for this solution and its neighborhood.
|
public static String getJson(LinkedList<ErlangCWeb.ErlangCResults> results, TimeUnit waitUnit)
result
has structure {"NumServers":n, "SL":sl, "Delay":delay, "AvgWaitTime":wait}.
Note all JSON values are returned in String format.
The returned string has the header Content-Type: application/json\n\n.
results
- the list of Erlang C evaluation resultswaitUnit
- the time unit of wait
public static String getJson(LinkedList<ErlangCWeb.ErlangCResults> results, TimeUnit waitUnit, int requiredServers)
umontreal.iro.lecuyer.ccoptim.web.TimeUnit)
except with an additional value that contains the required number of servers.
The JSON structure is:
{"Results":[result, result, ...], "AvgWaitTimeUnit":waitUnit, "RequiredServers":requiredServers }
where result
has structure { "NumServers":n, "SL":sl, "Delay":delay, "AvgWaitTime":wait }.
Note all JSON values are returned in String format.
The returned string has the header Content-Type: application/json\n\n.
results
- the list of Erlang C evaluation resultswaitUnit
- the time unit of wait
requiredServers
- the number of servers required to satisfy the service level targetpublic static String getJsonMessage(String message, String msgType)
msgType
is null
, then the msgType in JSON will be the
empty string ""
.
This method can be used to send an error message for example.
The returned string has the header Content-Type: application/json\n\n.
message
- the message to format in JSONpublic static String multiEvalErlangC(String arrivalRateP, String arrivalRateUnitP, String avgServiceTimeP, String avgServiceTimeUnitP, String capacityP, String numServerP, String awtP, String awtUnitP, String avgWaitTimeUnitP, String serverRangeP)
Use the parameter serverRangeP
to evaluate multiple numbers of servers around the
given numServerP
parameter.
The returned string is built by umontreal.iro.lecuyer.ccoptim.web.TimeUnit)
.
arrivalRateP
- arrival ratearrivalRateUnitP
- time unit of the arrival rate (string: "hour", "minute" or "second")avgServiceTimeP
- average service time (this is the inverse of the service rate)avgServiceTimeUnitP
- time unit of the average service timecapacityP
- queue capacity (must be integer, or set a negative integer value for unlimited queue capacity)numServerP
- number of servers (must be integer)awtP
- acceptable waiting timeawtUnitP
- time unit of the acceptable waiting timeavgWaitTimeUnitP
- time unit of the average waiting time result that will be returnedserverRangeP
- the range for multiple Erlang C evaluations. Let r be the range and n the number of
servers parameter, this program will evaluate Erlang C from n - r to n + r servers,
except if the number of servers is below 1.public static String multiEvalMinServers(String arrivalRateP, String arrivalRateUnitP, String avgServiceTimeP, String avgServiceTimeUnitP, String capacityP, String awtP, String awtUnitP, String targetSLP, String avgWaitTimeUnitP, String serverRangeP)
java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
.
It evaluates the performance measures using Erlang C around the required number of servers.
To make the input more convenient for the user, the parameters can be given in different time unit among this set: "hour", "minute" or "second". The time unit must be given as a string.
Use the parameter serverRangeP
to evaluate multiple numbers of servers around the
given numServerP
parameter.
The returned string is built by umontreal.iro.lecuyer.ccoptim.web.TimeUnit, int)
.
arrivalRateP
- arrival ratearrivalRateUnitP
- time unit of the arrival rate (string: "hour", "minute" or "second")avgServiceTimeP
- average service time (this is the inverse of the service rate)avgServiceTimeUnitP
- time unit of the average service timecapacityP
- queue capacity (must be integer, or set a negative integer value for unlimited queue capacity)awtP
- acceptable waiting timeawtUnitP
- time unit of the acceptable waiting timetargetSLP
- the service level target in percentage unit. This parameter must be between 0 and 100, inclusively.avgWaitTimeUnitP
- time unit of the average waiting time result that will be returnedserverRangeP
- the range for multiple Erlang C evaluations. Let r be the range and n the number of
servers parameter, this program will evaluate Erlang C from n - r to n + r servers,
except if the number of servers is below 1.public static void main(String[] args)
args
- see the method description