coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
119 stars 25 forks source link

Fix convexity unary #124

Closed svigerske closed 3 years ago

svigerske commented 3 years ago

On GAMS modellib model hda, I got a problem because std::dynamic_pointer_cast<ExpressionUnary>(child) was NULL even though child->getNumberOfChildren() == 1. Apparently, child was a product with only 1 child.

This pull request fixes this by checking that the expression is of type ExpressionUnary instead of checking the number of children.

svigerske commented 3 years ago

I don't know how to check why some tests failed. There is too little output to see whether that is connected to this pull-request.

andreaslundell commented 3 years ago

I will check this later. You can get more output from the tests with

test/test_runner <test> <number>

Where <test> is one of Model, Settings, Cbc, Cplex, Gurobi, GAMS, Solver or Ipopt. <number>is the test number that failed.

svigerske commented 3 years ago

The tests fail with

Starting test to solve problem with semicont. variables:
 Problem file "data/meanvarxsc.osil" does not exist.
Finished test to solve problem with semicont. variables.

I'll conclude that this has nothing to do with the changes in this pull request. You can probably easily add this file.