#ifndef _GRADIENT_PROJECTION_H
#define _GRADIENT_PROJECTION_H
#include <libvpsc/solve_VPSC.h>
#include <libvpsc/variable.h>
#include <libvpsc/constraint.h>
#include <libvpsc/generate-constraints.h>
#include <vector>
#include <iostream>
#include <math.h>
SimpleConstraint(unsigned l, unsigned r, double g)
unsigned left;
unsigned right;
double gap;
};
offsets(),
{}
void updatePosition() {
}
void* guide;
double position;
};
// create 2 dummy vars, based on the dimension we are in
// for each of the "real" variables, create a constraint that puts that var
// between our two new dummy vars, depending on the dimension.
}
}
double leftMargin;
double rightMargin;
double weight;
};
/**
* A DummyVarPair is a pair of variables with an ideal distance between them and which have no
* other interaction with other variables apart from through constraints. This means that
* the entries in the laplacian matrix for dummy vars and other vars would be 0 - thus, sparse
* matrix techniques can be used in laplacian operations.
* The constraints are specified by a two lists of pairs of variable indexes and required separation.
* The two lists are:
* leftof: variables to which left must be to the left of,
* rightof: variables to which right must be to the right of.
*/
leftof(),
rightof(),
place_l(0),
place_r(0),
b(0),
g(0),
old_place_l(0),
old_place_r(0)
{}
double place_l;
double place_r;
if(euclideanDistance > 1e-30) {
b /= euclideanDistance * dist;
} else { b=0; }
}
}
/**
* Setup vars and constraints for an instance of the VPSC problem.
* Adds generated vars and constraints to the argument vectors.
*/
}
}
}
/**
* Extract the result of a VPSC solution to the variable positions
*/
void updatePosition() {
}
/**
* Compute the descent vector, also copying the current position to old_place for
* future reference
*/
void computeDescentVector() {
}
/**
* move in the direction of steepest descent (based on g computed by computeGradient)
* alpha is the step size.
*/
}
/**
* add dummy vars' contribution to numerator and denominator for
* beta step size calculation
*/
}
/**
* move by stepsize beta from old_place to place
*/
}
double absoluteDisplacement() {
}
double b; // linear coefficient in quad form for left (b_right = -b)
double g; // descent vec for quad form for left (g_right = -g)
double old_place_r;
};
const Dim k,
unsigned n,
double** A,
double* x,
double tol,
unsigned max_iterations,
bool nonOverlapConstraints=false,
constrained(false)
{
for(unsigned i=0;i<n;i++) {
}
if(acs) {
++o) {
}
}
}
if (pbc) {
}
if (sc) {
}
}
constrained=true;
}
}
delete [] g;
delete [] d;
delete *i;
}
}
}
void clearDummyVars();
unsigned solve(double* b);
Dim k;
unsigned n; // number of actual vars
double** A; // Graph laplacian matrix
double* place;
// computations
iterations */
bool nonOverlapConstraints;
double tolerance;
unsigned max_iterations;
double* g; /* gradient */
double* d;
double* old_place;
bool constrained;
};
#endif /* _GRADIENT_PROJECTION_H */
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 :