views:

132

answers:

1

Is it possible to use the MSF api to specify a variable as semi-integer (V = 0, or a <= V <= b)?

The following is an example in LP_Solve that uses the "sec" and "int" keywords to indicate the variables are semi-continuous and integer.

max: 0.5 Q1 + 0.55 Q2 ;

Q1 >= 5;
Q1 <= 10 ;
Q2 >= 5;
Q2 <= 10;
Q1 + Q2 <= 10;

sec Q1,Q2 ;
int Q1,Q2 ;

Something similar in MSF would be nice. I note that it is possible to call a Gurobi Plugin DLL within MSF however I cannot find any place in that api to be able to set the type of the variable correctly (I think Gurobi calls it the VTYPE), so I assume it is either not exposed in their .net api or not available in the version of Gurobi that MSF uses? Alternatively, is there a nice way to call LP_Solve from .NET?

+3  A: 

You can do this with Solver Foundation but there is no equivalent for the "sec" keyword. Instead you can add a dummy 0-1 decision for each semi-integer variable. For your original example involving "V", here's how you could do it in OML:

Model[
  Decisions[
    Integers[0, 1],
    VPositive
  ],
  Decisions[
    Reals,
    V
  ],
  Constraints[
    constraint -> 10 * VPositive<= V <= 20 * VPositive
  ]
]

If you are using the Solver Foundation API then you would add the analagous decisions, constraints, goals using the object model. The way to specify the type of a decision is using a Domain, provided in the ctor.

Nathan Brixius