fuzzydl.milp
Class MILPHelper

java.lang.Object
  extended by fuzzydl.milp.MILPHelper

public class MILPHelper
extends java.lang.Object

Manager of a MILP problem, storing the inequations and calling an external MILP semantics.


Field Summary
static Bound BINARY_VARIABLE
          Gets a bound for a binary variable.
static Bound FREE_VARIABLE
          Gets a bound for an unrestricted real variable.
static boolean oneMpsFile
          Indicates whether to reuse always the same MPS file or to create a new file every time.
static boolean PRINT_LABELS
          Indicates whether we want to show the membership degrees to linguistic labels or not.
static boolean PRINT_VARIABLES
          Indicates whether we want to show the value of the variables or not.
 ShowVariablesHelper showVars
           
static Bound UP_BOUND_BY_ONE
          Gets an upper bound equal to 1.
 
Constructor Summary
MILPHelper()
          Default constructor
 
Method Summary
 void addNewConstraint(Expression expr, int constraintType)
          Add a new inequality of the form: expr constraintType 0.
 void addNewConstraint(Expression expr, int constraintType, Degree degree)
          Add a new inequality of the form: expr constraintType degree.
 void addStringFeature(java.lang.String role)
          Adds a string feature.
 void addStringValue(java.lang.String value, int intValue)
          Relates the value of a string feature with an integer value.
 MILPHelper clone()
           
 Variable getNewVariable(Bound bound)
          Gets a new variable with the indicated bound.
 Variable getVariable(java.lang.String varName)
          Gets a variable with the given name, creating a new one of type UP_BOUND_BY_ONE if it did not exist.
 Variable getVariable(java.lang.String varName, Bound bound)
          Gets a variable with the indicated bound.
static Bound INT_VARIABLE(int k1)
          Gets an integer bound with value k1.
 Solution optimize(Expression objective)
          It optimizes an expression.
 void printInstanceOfLabels(java.lang.String fName, java.lang.String indName, double value)
          Shows the membership degrees to some linguistic labels.
 void setObjective(Expression objective)
          States the objective to be MILP problem.
static void useOneMpsFile(boolean oneFile)
          Indicates whether the semantics uses always the same MPS file or not.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oneMpsFile

public static boolean oneMpsFile
Indicates whether to reuse always the same MPS file or to create a new file every time.


UP_BOUND_BY_ONE

public static final Bound UP_BOUND_BY_ONE
Gets an upper bound equal to 1.


BINARY_VARIABLE

public static final Bound BINARY_VARIABLE
Gets a bound for a binary variable.


FREE_VARIABLE

public static final Bound FREE_VARIABLE
Gets a bound for an unrestricted real variable.


PRINT_VARIABLES

public static boolean PRINT_VARIABLES
Indicates whether we want to show the value of the variables or not.


PRINT_LABELS

public static boolean PRINT_LABELS
Indicates whether we want to show the membership degrees to linguistic labels or not.


showVars

public ShowVariablesHelper showVars
Constructor Detail

MILPHelper

public MILPHelper()
Default constructor

Method Detail

INT_VARIABLE

public static final Bound INT_VARIABLE(int k1)
Gets an integer bound with value k1.

Parameters:
k1 - Value of the bound.
Returns:
An integer bound with value k1.

useOneMpsFile

public static void useOneMpsFile(boolean oneFile)
Indicates whether the semantics uses always the same MPS file or not.

Parameters:
oneFile - True if the semantics uses always the same MPS file.

clone

public MILPHelper clone()
Overrides:
clone in class java.lang.Object

optimize

public Solution optimize(Expression objective)
                  throws FuzzyOntologyException
It optimizes an expression.

Parameters:
objective - Expression to be optimized.
Returns:
An optimal solution of the expression.
Throws:
FuzzyOntologyException

printInstanceOfLabels

public void printInstanceOfLabels(java.lang.String fName,
                                  java.lang.String indName,
                                  double value)
Shows the membership degrees to some linguistic labels.

Parameters:
fName - Name of the feature.
indName - Name of the individual.
value - Value of the feature for the given individual.

getNewVariable

public Variable getNewVariable(Bound bound)
Gets a new variable with the indicated bound.

Parameters:
bound - A bound for the variable.
Returns:
A new variable with the indicated bound.

getVariable

public Variable getVariable(java.lang.String varName,
                            Bound bound)
Gets a variable with the indicated bound.

Parameters:
bound - A bound for the variable.
Returns:
A new variable with the indicated bound.

getVariable

public Variable getVariable(java.lang.String varName)
Gets a variable with the given name, creating a new one of type UP_BOUND_BY_ONE if it did not exist.

Parameters:
varName - Name of the variable.
Returns:
A variable with the given name.

addNewConstraint

public void addNewConstraint(Expression expr,
                             int constraintType)
Add a new inequality of the form: expr constraintType 0.

Parameters:
expr - An expression in the left side of the inequality.
constraintType - Type of the constraint (EQ, GR, LE).

addNewConstraint

public void addNewConstraint(Expression expr,
                             int constraintType,
                             Degree degree)
Add a new inequality of the form: expr constraintType degree.

Parameters:
expr - An expression in the left side of the inequality.
constraintType - Type of the constraint (EQ, GR, LE).
degree - A degree in the left side of the inequality.

setObjective

public void setObjective(Expression objective)
States the objective to be MILP problem.

Parameters:
objective - An objective expression to be optimized.

addStringFeature

public void addStringFeature(java.lang.String role)
Adds a string feature.

Parameters:
role - A string feature.

addStringValue

public void addStringValue(java.lang.String value,
                           int intValue)
Relates the value of a string feature with an integer value.

Parameters:
value - Value of a string feature.
intValue - Corresponding integer value.