本文整理汇总了C++中Plan::getNumSlackVars方法的典型用法代码示例。如果您正苦于以下问题:C++ Plan::getNumSlackVars方法的具体用法?C++ Plan::getNumSlackVars怎么用?C++ Plan::getNumSlackVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plan
的用法示例。
在下文中一共展示了Plan::getNumSlackVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate
double evaluate(Plan& P) {
//Compute Phase One
ADDvector xPhase1(P.getNumStepsWithUnknownDurration() + P.getNumSteps() + P.getNumSlackVars() + 1);
for(int i = 0; i < xPhase1.count(); i++) {
xPhase1[i] = mgr.addZero();
}
xPhase1[xPhase1.count()-1] = mgr.constant(10000); //inital value for s
ADDvector lambda(P.getNumFunctions());
for(int i = 0; i < lambda.count(); i++) {
lambda[i] = mgr.addZero();
}
ADDvector nu(P.getNumFunctions());
for(int i = 0; i < nu.count(); i++) {
nu[i] = mgr.addZero();
}
while(checkTeminationConditions(P, xPhase1, lambda, nu, true)) {
ADDvector DxPhase1(xPhase1.count());
ADDvector Dlambda(lambda.count());
ADDvector Dnu(nu.count());
calcStepDirection( xPhase1, lambda, nu,
DxPhase1, Dlambda, Dnu,
P, true);
takeStep( xPhase1, lambda, nu,
DxPhase1, Dlambda, Dnu);
}
//Compute Phase two
ADDvector x(xPhase1.count() -1);
for(int i = 0; i < x.count(); i++) {
x[i] = xPhase1[i];
}
while(checkTeminationConditions(P, x, lambda, nu, false)) {
ADDvector Dx(x.count());
ADDvector Dlambda(lambda.count());
ADDvector Dnu(nu.count());
calcStepDirection( x, lambda, nu,
Dx, Dlambda, Dnu,
P, false);
takeStep( x, lambda, nu,
Dx, Dlambda, Dnu);
}
//Really I need to do some max's and sum's here but that can be added later.
//Right now I need to add something to test all of this code.
return 0;
}