使用SumTermBuilder在Microsoft求解器基础中添加约束

时间:2014-02-27 17:17:01

标签: c#

请帮助我,我想使用SumTermBuilder添加约束,但我认为它不起作用 我的代码:

for (int i = 1; i < 97; i++)
{

    foreach (var item in newfeed)
    {

        float x = item.N_ED_Available_at_time_Total[i]/100;
        float y = item.OM_ED_Available_at_time_Total[i]/100;
        //get decision variables list
        var feeddecision = model.Decisions.First(it => it.Name == item.feed);
        //summation of all decision variables 
        N_Available_Total.Add(feeddecision * x); // For N
        OM_Available_Total.Add(feeddecision * y); // for OM
    }
    Hourly.Add((Model.Sqrt(Model.Power((25 - ((N_Available_Total.ToTerm() / OM_Available_Total.ToTerm()))), 2)))/96);

}
var SIConstraint = (25 - ((Hourly.ToTerm())) / 25) >= 0.9;
model.AddConstraint("SI", SIConstraint);

0 个答案:

没有答案