Below is the optimization model of an electrical circuit, the goal is to make the power loss minimized.
I use C# and SFS to define the model, which can be outputed as:
p_balance -> Foreach[
If[isSlack[iter1] == True, shuntAmount[iter1] == 0, -p[iter1] == v[iter1] * Sum[
v[iter2] * (g[iter1, iter2] * Cos[theta[iter1] - theta[iter2]] + b[iter1, iter2] * Sin[theta[iter1] - theta[iter2]])
q_balance -> Foreach[
If[isSlack[iter3] == True | vb[iter3] > 3602879701896397/9007199254740992, shuntAmount[iter3] == 0, -q[iter3] + shuntAmount[iter3] == v[iter3] * Sum[
v[iter4] * (g[iter3, iter4] * Sin[theta[iter3] - theta[iter4]] - b[iter3, iter4] * Cos[theta[iter3] - theta[iter4]])
slack_v -> Foreach[
If[isSlack[iter5] == True, v[iter5] == 1, True]
slack_theta -> Foreach[
If[isSlack[iter6] == True, theta[iter6] == 0, True]
v_offset -> Foreach[
Abs[v[iter7] - 1] < 3602879701896397/18014398509481984
PLoss_and_Cost -> Annotation[Sum[
((-(((2 * v[startID[iter8]]) * v[endID[iter8]]) * Cos[theta[startID[iter8]] - theta[endID[iter8]]]) + v[startID[iter8]] * v[startID[iter8]] + v[endID[iter8]] * v[endID[iter8]]) * r[iter8]) * (r[iter8] * r[iter8] + x[iter8] * x[iter8]) ^ -1
], "order", 0]
It seems not correct since I always get all the decisions to be 0, while the equation constraints are always violated. It should be mentioned that the model can only be solved with HybridLocalSearchDirective() and set the TimeLimit property to be a finite value, say, 5000. If I change the solver to any other, the same error message will be thrown:
No solver could be found that can accept the model given the model type and directive(s)
Can anyone help me to find the error? Many many thanks!
From the description of your problem, it seems to be that
"theta[nodes]" are really variables (or to MSF Terminology:
Decisions) whose values will be determined when the solution
to the problem is found.
What you really want is that you want to fix (or specify) some
of the "theta[nodes]" to certain known values:
For example, theta = 0.0;
In that case, you must add these specifications as "Equality
Constraints" to your problem.
The same seems to be the case with "vb[nodes]" and "v[nodes]"
The point is that the expression "Decisions" can be misleading
What seems to be happening in your problem is that you have to
specify certain values of the "theta[nodes]" in order to get a
The values of the remaining variables will be found by the
Solver when the problem is solved.
I hope that this helps.
Good luck with MSF!