本文整理汇总了C++中SizeOptions::ipl方法的典型用法代码示例。如果您正苦于以下问题:C++ SizeOptions::ipl方法的具体用法?C++ SizeOptions::ipl怎么用?C++ SizeOptions::ipl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SizeOptions
的用法示例。
在下文中一共展示了SizeOptions::ipl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d
/// Actual model
AllInterval(const SizeOptions& opt) :
Script(opt),
x(*this, opt.size(), 0, 66) { // 66 or opt.size() - 1
const int n = x.size();
IntVarArgs d(n-1);
IntVarArgs dd(66);
IntVarArgs xx_(n); // pitch class for AllInterval Chords
IntVar douze;
Rnd r(1U);
if ((opt.model() == MODEL_SET) || (opt.model() == MODEL_SET_CHORD) || (opt.model() == MODEL_SSET_CHORD) ||(opt.model() == MODEL_SYMMETRIC_SET)) // Modele original : serie
{
// Set up variables for distance
for (int i=0; i<n-1; i++)
d[i] = expr(*this, abs(x[i+1]-x[i]), opt.ipl());
// Constrain them to be between 1 and n-1
dom(*this, d, 1, n-1);
dom(*this, x, 0, n-1);
if((opt.model() == MODEL_SET_CHORD) || (opt.model() == MODEL_SSET_CHORD))
{
/*expr(*this,dd[0]==0);
// Set up variables for distance
for (int i=0; i<n-1; i++)
{
expr(*this, dd[i+1] == (dd[i]+d[i])%12, opt.icl());
}
// Constrain them to be between 1 and n-1
dom(*this, dd,0, n-1);
distinct(*this, dd, opt.icl());
*/
rel(*this, abs(x[0]-x[n-1]) == 6, opt.ipl());
}
if(opt.symmetry())
{
// Break mirror symmetry (renversement)
rel(*this, x[0], IRT_LE, x[1]);
// Break symmetry of dual solution (retrograde de la serie) -> 1928 solutions pour accords de 12 sons
rel(*this, d[0], IRT_GR, d[n-2]);
}
//series symetriques
if ((opt.model() == MODEL_SYMMETRIC_SET)|| (opt.model() == MODEL_SSET_CHORD))
{
rel (*this, d[n/2 - 1] == 6); // pivot = triton
for (int i=0; i<(n/2)-2; i++)
rel(*this,d[i]+d[n-i-2]==12);
}
}
else
{
for (int j=0; j<n; j++)
xx_[j] = expr(*this, x[j] % 12);
dom(*this, xx_, 0, 11);
distinct(*this, xx_, opt.ipl());
//intervalles
for (int i=0; i<n-1; i++)
d[i] = expr(*this,x[i+1] - x[i],opt.ipl());
dom(*this, d, 1, n-1);
dom(*this, x, 0, n * (n - 1) / 2.);
//d'autres choses dont on est certain (contraintes redondantes) :
rel(*this, x[0] == 0);
rel(*this, x[n-1] == n * (n - 1) / 2.);
// break symmetry of dual solution (renversement de l'accord)
if(opt.symmetry())
rel(*this, d[0], IRT_GR, d[n-2]);
//accords symetriques
if (opt.model() == MODEL_SYMMETRIC_CHORD)
{
rel (*this, d[n/2 - 1] == 6); // pivot = triton
for (int i=0; i<(n/2)-2; i++)
rel(*this,d[i]+d[n-i-2]==12);
}
if (opt.model() == MODEL_PARALLEL_CHORD)
{
rel (*this, d[n/2 - 1] == 6); // pivot = triton
for (int i=0; i<(n/2)-2; i++)
rel(*this,d[i]+d[n/2 + i]==12);
}
}
distinct(*this, x, opt.ipl());
distinct(*this, d, opt.ipl());
//.........这里部分代码省略.........