/*
* vim: ts=4 sw=4 et tw=0 wm=0
*
* libavoid - Fast, Incremental, Object-avoiding Line Router
*
* Copyright (C) 2005-2009 Monash University
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* See the file LICENSE.LGPL distributed with the library.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* library.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Author(s): Tim Dwyer <Tim.Dwyer@csse.monash.edu.au>
*
* --------------
*
* This file contains a slightly modified version of Solver() from libvpsc:
* A solver for the problem of Variable Placement with Separation Constraints.
* It has the following changes from the Adaptagrams VPSC version:
* - The required VPSC code has been consolidated into a single file.
* - Unnecessary code (like Solver) has been removed.
* - The PairingHeap code has been replaced by a STL priority_queue.
*
* Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net>
*
*/
#ifndef LIBAVOID_VPSC_H
#define LIBAVOID_VPSC_H
#include <vector>
#include <list>
#include <set>
#include <queue>
};
struct PositionStats {
void addVariable(Variable* const v);
double scale;
double AB;
double AD;
double A2;
};
{
double posn;
//double weight;
//double wposn;
~Block(void);
Constraint* findMinLM();
void deleteMinInConstraint();
void deleteMinOutConstraint();
void updateWeightedPosition();
void setUpInConstraints();
void setUpOutConstraints();
double cost();
bool deleted;
long timeStamp;
void addVariable(Variable* v);
};
{
double desiredPosition;
double finalPosition;
// be at it's desired position
double offset;
bool visited;
bool fixedDesiredPosition;
char *toString();
, offset(0)
, visited(false)
, fixedDesiredPosition(false)
{
}
double dfdv() const {
}
double position() const {
}
};
{
double gap;
double lm;
~Constraint();
double slack() const;
long timeStamp;
bool active;
const bool equality;
bool unsatisfiable;
};
/**
* A block structure defined over the variables such that each block contains
* 1 or more variables, with the invariant that all constraints inside a block
* are satisfied by keeping the variables fixed relative to one another.
*
* @todo check on this class being copy-n-paste duplicated.
*/
{
~Blocks(void);
void mergeRight(Block *l);
void cleanup();
double cost();
int nvs;
};
extern long blockTimeCtr;
struct UnsatisfiableException {
};
struct UnsatisfiedConstraint {
Constraint& c;
};
/*
* Variable Placement with Separation Constraints problem instance
*/
unsigned splitCnt;
bool satisfy();
bool solve();
void moveBlocks();
void splitBlocks();
~IncSolver();
unsigned m;
unsigned n;
void printBlocks();
void copyResult();
bool blockGraphIsCyclic();
};
struct delete_object
{
};
}
#endif // AVOID_VPSC_H