[英]Spot instance bidding strategy in Amazon EC2
My project is about determining an optimal bidding strategy for Amazon EC2 spot instances. 我的项目是为Amazon EC2竞价型实例确定最佳竞标策略。 I already have a document which is actually a research paper on this topic, it expresses the optimal bidding strategy via a recursive equation. 我已经有一个文档,该文档实际上是关于此主题的研究论文,它通过递归方程式表示最佳出价策略。
As of now my task is to implement this recursive algorithm, after that I have got to improve it to achieve more optimal bid price in order to minimize the average cost of computation while meeting the deadline at the same time. 到目前为止,我的任务是实现此递归算法,此后,我必须对其进行改进以实现更优的投标价格,以便在同时满足最后期限的同时将平均计算成本降至最低。
B∗t = B∗t+1 − (1 − p)F(B∗t+1)[B∗t+1 − G(B∗t+1)],
where, t = 0, • • • , T − 3 and B∗T−2 = Sod.
here B*t (read as B star t) means bidding price at time instant t
B*t+1(read as B star (t+1)th instant),similarly for B*T-2...
T is deadline of a job. Sod= on-demand instance price. F(.) & G(.) are distribution functions.
I am having problem in implementing this recursive equation. 我在实现此递归方程式时遇到问题。 I am using core Java for my project. 我在我的项目中使用核心Java。
I have written a code for that but not sure about the bodies of F() & G() this is what I have done so far 我已经为此编写了代码,但不确定F()和G()的主体,这是我到目前为止所做的
import java.util.Date;
class Job{
int computationTime;
int deadline;
public Job(int c,int T){
computationTime=c;
deadline=T;
}
}
public class SpotVm {
int c;
int T;
int Sod; //On-demand VM price
public SpotVm(Job j){
c=j.computationTime;
T=j.deadline;
}
public static int G(int t) {
}
public static int F(int t) {
}
public int bid(int t){
if(t<=T-3)
return (bid(t+1)-(1-p)F(bid(t+1))[bid(t+1)-G(bid(t+1))]);
else
return Sod;
}
public static void main(String[] args) {
Job j1=new Job(20,75);
SpotVm s1=new SpotVm(j1);
int bidvalue=s1.bid(10);
}
}
Please suggest me possible modifications what could be done on this code. 请建议我可能的修改,以便对此代码进行处理。
is more a java question than aws, ec2. 不仅仅是aw2,这是Java问题。 but i guess you want something like: 但是我想你想要这样的东西:
public double B(int t) {
if (t > (bigT - 2)) throw new Error("illegal value for t");
if (t < 0) throw new Error("illegal value for t");
if (t == (bigT - 2)) return Sod;
try {
return B(t + 1) - (1 - p) * F(B(t + 1)) * (B(t + 1) - G(t + 1));
} catch (Error e) {
throw e;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.