3

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?

David Nehme
  • 21,379
  • 8
  • 78
  • 117
freddy smith
  • 3,347
  • 5
  • 24
  • 28
  • ok, I have got the "nice" way of calling LP_Solve from .NET working, however my ideal solution would still be to use MSF as it has an easier feeling API to work with. Has anyone managed to get semi-integers working through MSF? – freddy smith Jan 18 '10 at 07:11

1 Answers1

4

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.