Skip to main content

module analysis::linearprogramming::LinearProgramming

rascal-0.40.16

Usage

import analysis::linearprogramming::LinearProgramming;

Dependencies

import analysis::linearprogramming::LLLinearProgramming;
import List;
import util::Maybe;
import Set;
import Map;

alias Coefficients

map[str var,num coef]

data LinearExpression

data LinearExpression  
= linearExp(Coefficients coefficients, num const)
;

alias ObjectiveFun

LinearExpression

function linearExp

ObjectiveFun linearExp(Coefficients coefficients)

data Constraint

data Constraint  
= constraint( Coefficients coefficients,
ConstraintType ctype, num const)
;

function neg

LinearExpression neg(LinearExpression exp)

function add

LinearExpression add(LinearExpression lhs, LinearExpression rhs)

function sub

LinearExpression sub(LinearExpression lhs, LinearExpression rhs)

function constraint

Constraint constraint(LinearExpression lhs, ConstraintType ctype)

Constraint constraint(LinearExpression lhs,
ConstraintType ctype, LinearExpression rhs)

alias Constraints

set[Constraint]

alias VariableVals

map[str var, num val]

data Solution

data Solution  
= solution(VariableVals varVals, num funVal)
;

function runObjFul

num runObjFul(ObjectiveFun f, VariableVals vals)

function minimizeNonNegative

Maybe[Solution] 
minimizeNonNegative(Constraints constraints, ObjectiveFun f)

function minimize

Maybe[Solution] 
minimize(Constraints constraints, ObjectiveFun f)

function maximizeNonNegative

Maybe[Solution] 
maximizeNonNegative(Constraints constraints, ObjectiveFun f)

function maximize

Maybe[Solution] 
maximize(set[Constraint] constraints, ObjectiveFun f)

function optimize

Maybe[Solution] 
optimize(bool minimize, bool nonZero,
Constraints constraints, ObjectiveFun f)

function toLLCoefficients

list[num] toLLCoefficients(Coefficients coefficients, list[str] indexVar)

function normalize

Coefficients normalize(Coefficients coefs)

function normalizeLinExp

LinearExpression normalizeLinExp(LinearExpression l)

function fromLLVariableVals

Coefficients 
fromLLVariableVals(LLVariableVals vars, list[str] indexVar)

function toLLObjectiveFun

LLObjectiveFun toLLObjectiveFun(ObjectiveFun f, list[str] indexVar)

function toLLConstraint

LLConstraint toLLConstraint(Constraint c, list[str] indexVar)

function toLLConstraints

LLConstraints toLLConstraints(Constraints cs, list[str] indexVar)

function getIndexVar

list[str] getIndexVar(Constraints cons,ObjectiveFun f)

function fromLLSolution

Solution fromLLSolution(LLSolution l, list[str] indexVar)