public class MILPHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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
Manages displayed variables.
|
| Constructor and Description |
|---|
MILPHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
addContradiction()
Add a contradiction to make the fuzzy KB unsatisfiable
|
void |
addCrispConcept(java.lang.String conceptName)
Defines a concept to be crisp.
|
void |
addCrispRole(java.lang.String roleName)
Defines a role to be crisp.
|
void |
addEquality(Variable var1,
Variable var2)
Add an equality of the form: var1 = var2.
|
void |
addNewConstraint(Assertion ass)
Adds a new inequality encoded in a fuzzy assertion.
|
void |
addNewConstraint(Assertion ass,
double n)
Given a fuzzy assertion a:C >= L and a number n, adds an inequality of the form: xAss >= n.
|
void |
addNewConstraint(Expression expr,
char constraintType)
Adds a new inequality of the form: expr constraintType 0.
|
void |
addNewConstraint(Expression expr,
char constraintType,
Degree degree)
Adds a new inequality of the form: expr constraintType degree.
|
void |
addNewConstraint(Expression expr,
char constraintType,
double n)
Adds a new inequality of the form: expr constraintType n.
|
void |
addNewConstraint(Variable x,
Degree D)
Add an inequality of the form: x >= D.
|
void |
addNewConstraint(Variable x,
double n)
Adds a new inequality of the form: x >= n.
|
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.
|
void |
changeVariableNames(java.lang.String oldName,
java.lang.String newName,
boolean oldIsCreatedIndividual)
Replaces the name of the variables including an individual name with the name of another individual name.
|
MILPHelper |
clone()
Gets a copy of the object.
|
boolean |
existsNominalVariable(java.lang.String i)
Exists a variable taking the value of an individual i belonging to the nominal concept {i.
|
Variable |
getNegatedNominalVariable(java.lang.String i1,
java.lang.String i2)
Gets a variable taking the value of an individual i1 not belonging to the nominal concept {i2}.
|
Variable |
getNewVariable(char type)
Gets a new variable with the indicated type.
|
Variable |
getNominalVariable(java.lang.String i1)
Gets a variable taking the value of an individual i belonging to the nominal concept {i}.
|
Variable |
getNominalVariable(java.lang.String i1,
java.lang.String i2)
Gets a variable taking the value of an individual i1 belonging to the nominal concept {i2}.
|
int |
getNumberForAssertion(Assertion ass)
Gets an integer codification of an assertion.
|
Variable[] |
getOrderedPermutation(Variable[] x) |
Variable[] |
getOrderedPermutation(Variable[] x,
Variable[][] z)
Gets an ordered permutation of the variables.
|
Variable |
getVariable(Assertion ass)
Gets a variable taking the value of a concept assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(CreatedIndividual ind)
Gets a variable taking the value of a concrete individual.
|
Variable |
getVariable(CreatedIndividual ind,
char bound)
Gets a variable taking the value of a concrete individual.
|
Variable |
getVariable(Individual ind,
Concept c)
Gets a variable taking the value of a concept assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(Individual a,
Individual b,
java.lang.String role)
Gets a variable taking the value of a role assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(Individual a,
Individual b,
java.lang.String role,
char type)
Gets a variable taking the value of a role assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(Individual ind,
Restriction restric)
Gets a variable taking the value of a universal restriction, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(Individual ind,
java.lang.String conceptName)
Gets a variable taking the value of a concept assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(Relation rel)
Gets a variable taking the value of a role assertion, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(java.lang.String name)
Gets a variable with the given name, creating a new one of type UP_BOUND_BY_ONE if it does not exist.
|
Variable |
getVariable(java.lang.String varName,
char type)
Gets a variable with the indicated name and bound.
|
boolean |
hasVariable(Assertion ass)
Cheks if there is a variable for a concept assertion.
|
boolean |
hasVariable(java.lang.String name)
Cheks if there is a variable with the given name.
|
boolean |
isCrispConcept(java.lang.String conceptName)
Checks if a concept is crisp or not.
|
boolean |
isCrispRole(java.lang.String roleName)
Checks if a role is crisp or not.
|
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 |
setBinaryVariables()
Transforms every [0,1]-variable into a {0,1} variable.
|
public static boolean PRINT_LABELS
public static boolean PRINT_VARIABLES
public ShowVariablesHelper showVars
public MILPHelper clone()
clone in class java.lang.Objectpublic Solution optimize(Expression objective)
objective - Expression to be optimized.public void printInstanceOfLabels(java.lang.String fName,
java.lang.String indName,
double value)
fName - Name of the feature.indName - Name of the individual.value - Value of the feature for the given individual.public Variable getNewVariable(char type)
type - Type of the new variable.public Variable getVariable(java.lang.String varName, char type)
varName - Name of the variable.type - Type of the variable.public Variable getVariable(java.lang.String name)
name - Name of the variable.public boolean hasVariable(java.lang.String name)
name - Name of the variable.public boolean hasVariable(Assertion ass)
ass - An assertion.public Variable getNominalVariable(java.lang.String i1)
i1 - An individual.public boolean existsNominalVariable(java.lang.String i)
i - An individual.public Variable getNominalVariable(java.lang.String i1, java.lang.String i2)
i1 - An individual that is subject of the assertion.i2 - An individual representing the nominal concept.public Variable getNegatedNominalVariable(java.lang.String i1, java.lang.String i2)
i1 - An individual that is subject of the assertion.i2 - An individual representing the nominal concept.public Variable getVariable(Assertion ass)
ass - A fuzzy concept assertion.public Variable getVariable(Relation rel)
rel - A fuzzy role assertion.public Variable getVariable(Individual ind, Restriction restric)
ind - Subject individual of the restrictions.restric - A fuzzy universal restriction.public Variable getVariable(Individual ind, Concept c)
ind - An individual.c - A fuzzy concept.public Variable getVariable(Individual ind, java.lang.String conceptName)
ind - An individual.conceptName - A fuzzy concept name.public Variable getVariable(Individual a, Individual b, java.lang.String role)
a - Object individual.b - Subject individual.role - Role.public Variable getVariable(Individual a, Individual b, java.lang.String role, char type)
a - Object individual.b - Subject individual.role - Role.type - Type of the variable.public Variable getVariable(CreatedIndividual ind)
ind - A concrete individual.public Variable getVariable(CreatedIndividual ind, char bound)
ind - A concrete individual.bound - char to the variable.public void addNewConstraint(Expression expr, char constraintType)
expr - An expression in the left side of the inequality.constraintType - Type of the constraint (EQ, GR, LE).public void addNewConstraint(Variable x, double n)
x - A variable.n - A real number.public void addNewConstraint(Assertion ass, double n)
ass - A fuzzy assertion.n - A real number.public void addNewConstraint(Variable x, Degree D)
x - A fuzzy assertion.D - A degree.public void addNewConstraint(Assertion ass)
ass - A fuzzy assertion.public void addNewConstraint(Expression expr, char constraintType, Degree degree)
expr - An expression in the left side of the inequality.constraintType - Type of the constraint (EQ, GR, LE).degree - A degree in the right side of the inequality.public void addNewConstraint(Expression expr, char constraintType, double n)
expr - An expression in the left side of the inequality.constraintType - Type of the constraint (EQ, GR, LE).n - A real number expression in the right side of the inequality.public void addEquality(Variable var1, Variable var2)
var1 - A variable.var2 - Another variable.public void addStringFeature(java.lang.String role)
role - A string feature.public void addStringValue(java.lang.String value,
int intValue)
value - Value of a string feature.intValue - Corresponding integer value.public void changeVariableNames(java.lang.String oldName,
java.lang.String newName,
boolean oldIsCreatedIndividual)
oldName - Old individual name.newName - New individual name.oldIsCreatedIndividual - Indicates whether the old individual is a created individual or not.public Variable[] getOrderedPermutation(Variable[] x, Variable[][] z)
x - A vector of input variables.z - A matrix of intermediate variables.public void addCrispConcept(java.lang.String conceptName)
conceptName - A concept name.public void addCrispRole(java.lang.String roleName)
roleName - A role name.public boolean isCrispConcept(java.lang.String conceptName)
conceptName - A concept name.public boolean isCrispRole(java.lang.String roleName)
roleName - A role name.public void setBinaryVariables()
public int getNumberForAssertion(Assertion ass)
ass - An assertion.public void addContradiction()