I want to run a rather demanding check of feasibility.
I have 3565 non-negativity constraints for my variables, and one that makes them sum to a certain budget they shall not surpass. I also have one inequality constraint that calculates whether or not, for a given set of values of the variables, a given constant is smaller or larger than the Gini coefficient for the current data.
The expression looks like this:
GWSUB[y_, ES_, t_, w_, k_] := Module[{yt, ytw, Gini},
yt = (y + t) / ES;
ytw = (w*(y + t)) / ES;
Gini = -k*(2*(Plus @@ w)*(Plus @@ ytw)) +
Sum[ (w[[j]]*(Plus @@ Abs[ytw - yt[[j]]*w]), {j, 1, Length[y]}
]
Here are the meanings of the symbols I used:
- The vector of variables is $t$.
- $y$ is a vector of incomes.
- $w$ is a vector of weights.
ES
is a separate vector of weights.- $k$ defines the candidate value for the Gini coefficient and is a scalar.
The vectors are all of length 3565.
I then tried to run the FindMinimum
command. Here T
is the vector of variables t[i]
. TC
are the non-negativity constraints on the t[i]
.
B
is the budget (a scalar).
FindMinimum[
{
0*(Plus @@ T),
GWSUB[Y, ES, T, W, 0.3294] <= 0,
Sequence[TC], (Plus @@ T) == B
},
T,
Method -> "InteriorPoint", WorkingPrecision -> 7, MaxIterations -> 500
]
I get an error of this form:
FindMinimum::cnpcons: Could not process the constraints ...
and then it refers to the GWSUB expression.
Does this mean that I cannot run the computation with the current machine? Is there a way to simplify the expression, so that Mathematica will process it?
My Value Configuration
To reproduce my results you will need the following data set:
https://www.dropbox.com/s/qni6zoecmdm9p1x/data.xls?dl=0
Then import the data set and use the following set up:
Y = Table[dta[[j]][[1]], {j, 1, 100}];
W = Table[dta[[j]][[3]], {j, 1, Length[Y]}];
ES = Table[dta[[j]][[2]], {j, 1, Length[Y]}];
T = Table[t[i], {i, 1, Length[Y]}];
TC = Table[t[i] >= 0., {i, 1, Length[Y]}];
TS = Table[{t[i], 0.}, {i, 1, Length[Y]}];
B = 2791967732
Minor Update
I have tried to let FindMinimum
only evaluate numerically by compiling the aforementioned GWSUB
function with "RuntimeOptions" -> {"EvaluateSymbolically" -> False}
. While the calculations of the GWSUB
function are faster, the call to FindMinimum
still resulted in the same error message.
T
andTC
. $\endgroup$0*(Plus @@ T)
and(Plus @@ T) == B
as equations? The first isn't even an equation (and it evaluates to zero anyway). Can you check your syntax and your definitions first? $\endgroup$