0

I am new to SCIP and have read through some of the example problems and documentation, but am still unsure how to formulate the following problem for the SCIP solver:

argmax(w) sum(sign(Aw) == sign(b))

where A is a nxm matrix, w is a mx1 vector, and b is a nx1 vector. The data type is floats/real numbers, and it is a constraint-free problem.

Values for A and b are also contained row-wise in a .txt file. How can I import that?

Overall - I am new to SCIP and have no idea how to start creating variables (especially the objective function value parameter), importing data, formulate the objective function... It's a bit of a stretch for me to ask this question, but your help is appreciated!

tamtam
  • 641
  • 9
  • 24
  • 1
    Make sure to get the basics of those optimization problems first before implementing. This one line has tons of potential to be *very annoying*(!): equality-comparison and the undifferentiable sign-function. The usual approach is to transform the constraint-free sign/abs problem to a constrained sign/abs-free problem. But i would not do that blindly (without having a clear idea of how my approach is expected to work for my problem). Additionally: asking on how to import data while also asking about modelling is often a sign for bad preparation / very early approaches. Invest some time. – sascha Oct 28 '18 at 10:27
  • As @sascha already pointed out: You seem to be quite early in the modelling/development process. I recommend to start with PySCIPOpt (https://github.com/SCIP-Interfaces/PySCIPOpt), because the first steps are way easier in Python than in C/C++ - especially when you're also parsing unformatted .txt files. – mattmilten Oct 28 '18 at 17:28
  • Also don't fix yourself on using a sign() function. sign(b) seems to be fixed already and for each entry of Aw, use a binary variable to indicate whether its sign is positive or negative. Then the sum() just becomes a simple sum over binary variables (or their negation, depending on sign(w)). – stefan Oct 28 '18 at 19:36
  • 1
    I have never seen an objective like this. Looks somewhat familiar to a classification problem. What is the background for this? – Erwin Kalvelagen Oct 31 '18 at 23:41

1 Answers1

1

This should work:

enter image description here

where beta(i) = sign(b(i)). The implication can be implemented using indicator constraints. This way we don't need big-M's.

Most likely the >= 0 constraint should be >= 0.0001 (otherwise we can set all w(j)=0).

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39