scale.score.dependence.omega.omegaLib
Class Problem

java.lang.Object
  extended by scale.score.dependence.omega.omegaLib.Problem

public final class Problem
extends java.lang.Object

Problem.

$Id: Problem.java,v 1.21 2007-10-16 14:32:55 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

This version of the Omega Libray is a translation from C++ to Java of the Omega Library developed at the University of Maryland.

Copyright (C) 1994-1996 by the Omega Project

All rights reserved.

NOTICE: This software is provided ``as is'', without any warranty, including any implied warranty for merchantability or fitness for a particular purpose. Under no circumstances shall the Omega Project or its agents be liable for any use of, misuse of, or inability to use this software, including incidental and consequential damages.

License is hereby given to use, modify, and redistribute this software, in whole or in part, for any purpose, commercial or non-commercial, provided that the user agrees to the terms of this copyright notice, including disclaimer of warranty, and provided that this copyright notice, including disclaimer of warranty, is preserved in the source code and documentation of anything derived from this software. Any redistributor of this software or anything derived from this software assumes responsibility for ensuring that any parties to whom such a redistribution is made are fully aware of the terms of this license and disclaimer.

The Omega project can be contacted at omega@cs.umd.edu or http://www.cs.umd.edu/projects/omega


Field Summary
static int BLACK
           
static int noRed
           
static int RED
           
static int redConstraints
           
static int redFalse
           
 
Constructor Summary
Problem(OmegaLib omegaLib, int in_eqs, int in_geqs)
           
Problem(OmegaLib omegaLib, int in_eqs, int in_geqs, Conjunct varNameSource)
           
Problem(Problem p2)
           
Problem(Problem p2, Conjunct varNameSource)
           
 
Method Summary
 Equation addEQ()
           
 Equation addGEQ()
           
 int addNewUnprotectedWildcard()
           
 boolean anyNonZeroCoef(int var)
           
 void clearSubs()
           
 void combineColumns(int i, int j)
           
 void convertEQstoGEQs(boolean excludeStrides)
           
 void copyColumn(int to_col, Problem fp, int fr_col, int start_EQ, int start_GEQ)
          Copy column fr_col of problem fp to column to_col of this problem.
static int created()
           
 int difficulty()
           
 boolean expensiveRedKill()
           
 int findColumn(int column)
           
 boolean findEquality(int c_to, int c_from, int initial)
           
 Equation[] getEQs()
           
 Equation[] getGEQs()
           
 Equation getNewEQ()
          Make a new BLACK equation in a given problem
 Equation getNewEQ(Equation eq)
           
 Equation getNewGEQ()
           
 Equation getNewGEQ(Equation eq)
           
 int getNumEQs()
           
 int getNumGEQs()
           
 boolean isEmpty()
          Return true if there are no equations.
 boolean isNoSubs()
          Return true if there are no substitutions.
 boolean isNotEQZero(int ignoreEQ, int var)
           
 int mapToColumn()
           
 void merge(int action, Conjunct conj1, Conjunct conj2, Conjunct conj3, Vector<VarDecl> newVars)
           
 int numberNZ()
           
 int numSafeVars()
           
 int numVars()
           
 void orderedElimination(int symbolic)
           
 java.lang.String orgVariable(int i)
           
 int prettyPrintProblem()
           
 java.lang.String prettyPrintProblemToString()
           
 java.lang.String printEQtoString(Equation e)
           
 java.lang.String printGEQtoString(Equation e)
           
 void printProblem()
           
 void printProblem(boolean debug)
           
 void printRedEquations()
           
 java.lang.String printSubToString(int v)
           
 java.lang.String printTermToString(Equation eq, int c)
           
 java.lang.String printTermToString(Equation eq, int c, int nVars)
           
 boolean queryDifference(int v1, int v2, int[] bounds)
           
 boolean queryVariableBounds(int i, int[] bounds)
           
 int redSimplifyProblem(int effort, boolean computeGist)
           
 void removeColorConstraints()
           
 void resetVarAndForwarding()
           
 void setNumSafeVars(int number)
           
 void setNumVars(int number)
           
 void setVariablesInitialized(boolean variablesInitialized)
           
 void setVarNameSource(Conjunct varNameSource)
           
 boolean simplifyApproximate(boolean strides_allowed)
           
 boolean simplifyProblem(boolean verify, int redundantElimination)
           
 void swapVars(int i, int j)
           
 java.lang.String toString()
           
 void touchAllEQs()
           
 void touchAllGEQs()
           
 boolean trytoSub(int col)
          We're going to try to describe the equalities among a set of variables.
 void turnRedBlack()
           
 int varMappedAt(int i)
           
 void zeroColumn(int to_col, int start_EQ, int start_GEQ, int no_EQs, int no_GEQs)
          Zero column to_col of this problem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

noRed

public static final int noRed
See Also:
Constant Field Values

redFalse

public static final int redFalse
See Also:
Constant Field Values

redConstraints

public static final int redConstraints
See Also:
Constant Field Values

RED

public static final int RED
See Also:
Constant Field Values

BLACK

public static final int BLACK
See Also:
Constant Field Values
Constructor Detail

Problem

public Problem(OmegaLib omegaLib,
               int in_eqs,
               int in_geqs,
               Conjunct varNameSource)

Problem

public Problem(OmegaLib omegaLib,
               int in_eqs,
               int in_geqs)

Problem

public Problem(Problem p2,
               Conjunct varNameSource)

Problem

public Problem(Problem p2)
Method Detail

created

public static int created()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isEmpty

public boolean isEmpty()
Return true if there are no equations.


isNoSubs

public boolean isNoSubs()
Return true if there are no substitutions.


getGEQs

public Equation[] getGEQs()

getNumGEQs

public int getNumGEQs()

getEQs

public Equation[] getEQs()

getNumEQs

public int getNumEQs()

simplifyProblem

public boolean simplifyProblem(boolean verify,
                               int redundantElimination)

simplifyApproximate

public boolean simplifyApproximate(boolean strides_allowed)

redSimplifyProblem

public int redSimplifyProblem(int effort,
                              boolean computeGist)

convertEQstoGEQs

public void convertEQstoGEQs(boolean excludeStrides)

expensiveRedKill

public boolean expensiveRedKill()

resetVarAndForwarding

public void resetVarAndForwarding()

setVariablesInitialized

public void setVariablesInitialized(boolean variablesInitialized)

printSubToString

public java.lang.String printSubToString(int v)

printTermToString

public java.lang.String printTermToString(Equation eq,
                                          int c)

printTermToString

public java.lang.String printTermToString(Equation eq,
                                          int c,
                                          int nVars)

clearSubs

public void clearSubs()

setVarNameSource

public void setVarNameSource(Conjunct varNameSource)

orgVariable

public java.lang.String orgVariable(int i)

printGEQtoString

public java.lang.String printGEQtoString(Equation e)

printEQtoString

public java.lang.String printEQtoString(Equation e)

printProblem

public void printProblem()

printProblem

public void printProblem(boolean debug)

printRedEquations

public void printRedEquations()

prettyPrintProblem

public int prettyPrintProblem()

prettyPrintProblemToString

public java.lang.String prettyPrintProblemToString()

getNewGEQ

public Equation getNewGEQ()

getNewGEQ

public Equation getNewGEQ(Equation eq)

addGEQ

public Equation addGEQ()

getNewEQ

public Equation getNewEQ()
Make a new BLACK equation in a given problem


getNewEQ

public Equation getNewEQ(Equation eq)

addEQ

public Equation addEQ()

queryDifference

public boolean queryDifference(int v1,
                               int v2,
                               int[] bounds)

queryVariableBounds

public boolean queryVariableBounds(int i,
                                   int[] bounds)

numberNZ

public int numberNZ()

difficulty

public int difficulty()

turnRedBlack

public void turnRedBlack()

addNewUnprotectedWildcard

public int addNewUnprotectedWildcard()

swapVars

public void swapVars(int i,
                     int j)

orderedElimination

public void orderedElimination(int symbolic)

removeColorConstraints

public void removeColorConstraints()

anyNonZeroCoef

public boolean anyNonZeroCoef(int var)

copyColumn

public void copyColumn(int to_col,
                       Problem fp,
                       int fr_col,
                       int start_EQ,
                       int start_GEQ)
Copy column fr_col of problem fp to column to_col of this problem. Displacement for constraints in this problem are start_EQ and start_GEQ.


zeroColumn

public void zeroColumn(int to_col,
                       int start_EQ,
                       int start_GEQ,
                       int no_EQs,
                       int no_GEQs)
Zero column to_col of this problem. Displacement for constraints in to_conj are start_EQ and start_GEQ. Number of constraints to zero are no_EQ and no_GEQ.


merge

public void merge(int action,
                  Conjunct conj1,
                  Conjunct conj2,
                  Conjunct conj3,
                  Vector<VarDecl> newVars)

varMappedAt

public int varMappedAt(int i)

numSafeVars

public int numSafeVars()

numVars

public int numVars()

setNumSafeVars

public void setNumSafeVars(int number)

setNumVars

public void setNumVars(int number)

mapToColumn

public int mapToColumn()

combineColumns

public void combineColumns(int i,
                           int j)

touchAllGEQs

public void touchAllGEQs()

touchAllEQs

public void touchAllEQs()

findColumn

public int findColumn(int column)

trytoSub

public boolean trytoSub(int col)
We're going to try to describe the equalities among a set of variables. We want to perform some substitutions to ensure that we don't miss v_1 = v_2 due to its expression as v_1 = v_3 && v_2 = v_3 We therefore try to substitute out all variables that we don't care about (e.g., v_3 in the above example).


findEquality

public boolean findEquality(int c_to,
                            int c_from,
                            int initial)

isNotEQZero

public boolean isNotEQZero(int ignoreEQ,
                           int var)