// put the constraints into the LP problem
void
-Spacing_problem::make_constraints(Optimisation_problem& lp) const
+Spacing_problem::make_constraints(Mixed_qp& lp) const
{
int dim=cols.sz();
for (int j=0; j < dim; j++) {
/* optimalisatiefunctie */
- Optimisation_problem lp(cols.sz());
+ Mixed_qp lp(cols.sz());
make_matrices(lp.quad,lp.lin, lp.const_term);
make_constraints(lp);
Vector start=find_initial_solution();
Colinfo c;
c.fixed=fixed;
c.fixpos=fixpos;
+ assert(col);
c.col=col;
cols.add(c);
}
int l = col_id(id->left);
int r = col_id(id->right);
- mtor << "idealspacing { between " << l <<","<<r<<'\n';
- mtor << "distance "<<id->space<< " strength " << id->hooke << "}\n";
+ mtor << "between " << l <<","<<r<<":" ;
#endif
}
void
Spacing_problem::print() const
{
- #ifndef NPRINT
+#ifndef NPRINT
for (int i=0; i < cols.sz(); i++) {
mtor << "col " << i<<' ';
cols[i].print();
for (int i=0; i < ideals.sz(); i++) {
print_ideal(ideals[i]);
}
- #endif
+#endif
}
mtor << "column { ";
if (fixed)
mtor << "fixed at " << fixpos<<", ";
+ assert(col);
mtor << "[" << minleft() << ", " << minright() << "]";
mtor <<"}\n";
#endif
}
-
+Colinfo::Colinfo()
+{
+ fixed=false;
+ col=0;
+}
// utility functions for PScore
#include "debug.hh"
+#include "dimen.hh"
#include "line.hh"
#include "pscore.hh"
#include "tstream.hh"
Idealspacing*ip =new Idealspacing(l,r);
suz.bottom().add(ip);
- // l->used = r->used = true;
+
return ip;
}
{
cols.bottom().add(p);
}
-/*
- todo: config of width
- */
+
PScore::PScore()
{
- linewidth = 15; // in cm for now
+ linewidth = convert_dimen(15,"cm");
}
void
PScore::output(Tex_stream &ts)
{
int l=1;
- ts << "% linewidth " << linewidth * HOR_TO_PT << " pt\n";
+ ts << "% linewidth " << print_dimen(linewidth )+"\n";
for (PCursor<Line_of_score*> lic(lines); lic.ok(); lic++) {
ts << "% line of score no. " << l++ <<"\n";
ts << lic->TeXstring();
ts << "\\interscoreline\n";
}
}
+
+svec<Item*>
+PScore::select_items(PStaff*ps , PCol*pc)
+{
+ svec<Item*> ret;
+ assert(ps && pc);
+ for (PCursor<const Item*> ic(pc->its); ic.ok(); ic++){
+ if (ic->pstaff_ == ps)
+ ret.add((Item*)(const Item*)ic);
+ }
+ return ret;
+}
+
+void
+PScore::OK()const
+{
+ for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+ cc->OK();
+ for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+ ic->OK();
+
+}
+void
+PScore::print() const
+{
+
+ #ifndef NPRINT
+ mtor << "PScore { width "<<print_dimen(linewidth);
+ mtor << "\ncolumns: ";
+ for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+ cc->print();
+
+ mtor << "\nideals: ";
+ for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+ ic->print();
+ mtor << "}\n";
+ #endif
+}
+