Comments (5)
Oops, yes, I was trying to put a CRTL-C handler into HiGHS but gave up, and failed to remove the development code (Lines 52 onwards in lp_data/Highs.cpp
)
void highsSignalHandler(int signum) {
// std::cout << "Interrupt signal (" << signum << ") received.\n";
exit(signum);
}
Highs::Highs() { signal(SIGINT, highsSignalHandler); }
Since there is not (yet) anything in the HiGHS Fortran API to handle callbacks, do I infer from the following that you had to wrote something yourself and had to get around the fact that in HighsCallbackDataOut
(see lp_data/HighsCallbackStruct.h
) the pointer to the values of the solution is not on an 8-byte boundary - since an int
, two HighsInt
(which can be 4 or 8 bytes) and an int64_t
constitute an odd number of 4-byte words. I can get around this by making double* mip_solution
the first member of the HighsCallbackDataOut
struct. That scalar doubles won't be on 8-byte boundaries presumably has little overhead.
Assuming that you wrote your own Fortran API to handle callbacks, could you share it with me since I wouldn't know how to write it.
The callback to retrieve the variable-length double 1D-array mip_solution(*) works well except that I noticed an arbitrary five (5) element offset in order to properly align the C mip_solution() vector into the Fortran mip_solution() i.e., mip_solution(1+5:n+5) where "n" is the known length of variables. Otherwise, the variable solution data for each integer-feasible solution is received properly including the mix of reals and integers placed before mip_solution().
from highs.
from highs.
Thanks for letting me know about the CRTL-C signal handler - I look forward
to it being removed in your next release :-)
I've asked the two other folk with whom I've communicated regarding the CRTL-C signal handler, just out of politeness, as removing it would, technically, break the API
Technically speaking, all C to Fortran API's seem to be redundant given
standard Fortran's C Interoperability capability. Hence I never use these
API's supplied by 3rd C/C++ based solvers as they are usually out-of-date
and incomplete as well.
That's interesting to know. Our Fortran API can certainly be classed as "out-of-date and incomplete". I'll still keep it, as it does no harm, but add a comment to the effect that it's out-of-date and incomplete, and that folk should exploit standard Fortran's C Interoperability capability.
The way all of the other MIP callbacks are implemented is to allow the user
to call for example your Highs_getSolution() routine (or the like) to
retrieve the MIP improving solutions inside the callback routine.
This wouldn't work in HiGHS, as no MIP solver data can be reached via the Highs C++ API. Indeed, if a user's callback function were to start calling methods in the instance of the Highs class (by passing a pointer to it via the void* user_data parameter) then all sorts of chaos could ensue! I should add code to the Highs C++ API to ensure that all methods give an immediate error return!
Thanks for the Fortran callback function. I'll add it to examples/call_highs_from_fortran.f90
.
I can get around this by making double* mip_solution the first member of
the HighsCallbackDataOut struct. That scalar doubles won't be on 8-byte
boundaries presumably has little overhead.
That may work but I am not sure if the other appended integers and doubles
will be affected with offsets in a similar way when receiving their values
in Fortran.
Ah, so they may be wrong, not just slower to access. I'm forgetting my Fortran implications!
from highs.
from highs.
I'm trying to call the Highs
instance from a call-back in check/TestCallbacks.cpp
, but don't see how to pass and use the Highs instance via the void*
pointer in highs-callback-no-highs-call
in check/TestCallbacks.cpp
See branch fix-1523-latest
from highs.
Related Issues (20)
- Add irreducible inconsistent system (IIS) identification for LP
- Build fails on macOS: `f951: Error: '-fno-fat-lto-objects' are supported only with linker plugin` HOT 3
- Get Column Cost HOT 1
- Spurious statement of Integer when writing model HOT 1
- primal_solution_status is reported as kSolutionStatusFeasible for infeasible model when solver=ipm and presolve=off
- How to Set a Partial MIP Solution using setSolution()? HOT 11
- Logging header not printed if `h.writeModel` or `h.writeSolution` called before a method using the HighsIO
- `Highs::writeModel("")` uses `HighsIO`, but `Highs::writeSolution("")` uses `fprintf` for stdout HOT 1
- HiGHS 1.7.1 HighsCallbackDataOut data type can no longer be accessed directly for mip_solution item. HOT 1
- Time limit solving Jeroslow MIP seems not to be triggered HOT 2
- Stop MIP solve on `simplex_iteration_limit` (or other LP iteration limit) - Access iteration count via callback? HOT 2
- CMake configuration fails with versions >3.23.0 and <3.24.0
- Longer runtimes for ILP models created with `addVariable` versus `addCol` HOT 4
- PInvokeStackImbalance exception when targetting .NET Framework (Windows)
- highspy API improvements and benchmark HOT 1
- Stream HiGHs solver output in pyomo HOT 1
- Add user cuts
- Running in Parallel gives unexpected result. HOT 9
- LeakSanitizer locates memory leaks in highs HOT 2
- linker error due to .res files from v1.7.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highs.