Eu tento modelo de um MIP modelo no CPLEX. Eu tenho uma função que inclui variáveis de decisão e eu preciso tomar integral desta função para calcular o seu valor esperado. Existe alguma maneira de tirar integral de uma função em CPLEX? Obrigado!
0
com piecewise linear, você pode aproximar qualquer função e dependem de Programação Matemática.
Ver Interpolar qualquer função em Dicas e Truques na OPL
// linearization of f(x)=1/x through a piecewise linear function
int sampleSize=10000;
float s=1;
float e=10;
float x[i in 0..sampleSize]=s+(e-s)*i/sampleSize;
int nbSegments=5;
float x2[i in 0..nbSegments]=(s)+(e-s)*i/nbSegments;
float y2[i in 0..nbSegments]=1/x2[i]; // y=f(x)
float firstSlope=0;
float lastSlope=0;
tuple breakpoint // y=f(x)
{
key float x;
float y;
}
sorted { breakpoint } breakpoints={<x2[i],y2[i]> | i in 0..nbSegments};
float slopesBeforeBreakpoint[b in breakpoints]=
(b.x==first(breakpoints).x)
?firstSlope
:(b.y-prev(breakpoints,b).y)/(b.x-prev(breakpoints,b).x);
pwlFunction f=piecewise(b in breakpoints)
{ slopesBeforeBreakpoint[b]->b.x; lastSlope } (first(breakpoints).x, first(breakpoints).y);
assert forall(b in breakpoints) abs(f(b.x)-b.y)<=0.001;
Com Restrição de Programação, dentro CPLEX você pode usar qualquer função (ainda não linear) e até mesmo blackbox função.
Exemplo de não linear função de:
using CP;
// CPOptimizer allows all kind of non linearities
int nbKids=300;
float costBus40=500;
float costBus30=400;
dvar int+ nbBus40;
dvar int+ nbBus30;
// Non linear objective (exponential)
minimize
costBus40*exp(nbBus40) +exp(nbBus30)*costBus30;
subject to
{
40*nbBus40+nbBus30*30>=nbKids;
}