How integrate a linear programming solver like CPLEX in VB.NET? - vb.net

I want to solve a linear programming model which is build through VB.NET. In this context I have following questions,
a) How to call a CPLEX or any such solver (Coin-OR) through VB.NET?
(While doing so I do not want CPLEX window to be opened. i.e. It should solve it in the background.)
b) How to transfer the LP model to CPLEX? (Again I want to stay away from opening a new window and then write the model to CPLEX)
VB.NET understanding: Intermediate
Thanks

Microsoft Solver Foundation provides a plugin for CPLEX, and there are samples that shows both how to invoke the CPLEX plug-in and how to call MSF from VB.NET. You can download the standard MSF library from here.

CPLEX can be used in VB.NET through the CPLEX/Concert .NET API which is a standard API supplied with the solver and is pretty straightforward to use. There is a good documentation available including this example and this tutorial. Examples are in C# but should give you the idea how to use the API in any .NET language.
You could also use MS Solver Foundation but it incurs additional costs and the product is discontinued.

Related

Is it possible to use Microsoft Visual Studio to build an UI for a CPLEX Optimization Model?

I'm currently building a timetable model on CPLEX O.S. My question is: is it possible to connect it to Microsoft Visual Studio in order to create an UI to let the user enter the initial data and parameters? Or maybe let Excel be the data input interface and then have a V.S built interface to load that file and begin the optimization problem? I would like to make it as easier as possible to optimize a timetable using the model I'm creating. I've been searching for it and found something called Concert Technology, not sure if this is what I need, still learning about it.
Yes, this is absolutely possible. If you're going to be using Visual Studio, the easiest option is probably to create a GUI application using .NET. Then, you can consume the CPLEX .NET API from within your application. Another option would be to use C++, but that would probably be considerably more complex. There's really no difference between calling CPLEX from a GUI application versus calling CPLEX from a console application. Usually you would add some logic to a button click event handler that would build the model in CPLEX, solve it, and gather the solution information. Take a look at the CPLEX User's Manual, CPLEX .NET Reference Manual, CPLEX C++ Reference Manual, and the many examples that are included with CPLEX when you install the software.
Absolutely, as Alex and rkersh already said. It is much much simpler than people expect to just write your application as you want it to be in C# or C++ (or any of the other supported languages). Then just use the CPLEX Concert API calls into the CPLEX library to build and solve your model and retrieve the answers. It won't make any difference to the performance of your model whichever language you use. Using the CPLEX API means that it is just like any other library. CPLEX is just software like any other.
there are many options:
You can write everything in C++ or C# with the CPLEX Concert API https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/tutorials/Cplusplus/cpp_synopsis.html
You may call OPL from C++ or C# with API https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/usroplinterfaces/topics/opl_interf_intro_cpp.html
You may try VSTO : https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.3/ilog.odms.ide.help/OPL_Studio/usroplinterfaces/topics/opl_interfaces_work_integrateExcel.html
You may call OPL from Excel

Cutting Plane using Java

I am working in my project using Java with Cplex library. But I'm stuck at applying cuttting plane. Is there any tutorial or article for that? Thanks for your help.
There are many examples included with CPLEX when you install CPLEX Optimization Studio (COS). For example, if COSDIR is the location where you installed the product, then the examples can be found at COSDIR/cplex/examples/src/java. In particular, you should look at the AdMIPex4.java and AdMIPex8.java examples. See the documentation for the new generic callbacks in CPLEX 12.8 or the legacy callbacks.

Does anyone know of any VB.Net code generation plug-ins for StarUML?

Simple question really. No elaboration required.
I have found similar tools for Java, C#, C++ and other languages but not VB.Net.
Thanks
Unfortunately, I don't know of a plugin for StarUML that will generate VB.NET code, however, if using a different modelling tool is a possibility, Sparx System's Enterprise Architect will generate code in VB.NET (as well as many other languages).
Enterprise Architect enables you to
generate source code from UML model
elements, creating a source code
equivalent of the Class or Interface
element for future elaboration and
compilation. In particular you can
generate C, C++, C#, Delphi, Java,
PHP, Python, ActionScript, Visual
Basic and VB.NET source code. The
source code generated includes Class
definitions, variables and function
stubs for each attribute and method in
the UML Class.
Unfortunately, Enterprise Architect is not free nor is it open source, however, there is a full functional 30 day trial available, along with discount options for academic pricing (if appropriate).
If you're looking to stay with free and/or open source software, I think the closest for VB.NET code generation would be to use a couple of tools in conjunction with each other:
Dia is an open source, GTK+ based diagram creation program for Linux, Unix and Windows released under the GPL license. You can use this to create your UML diagrams. From there, you would use:
Project: CodeGen from Novell, which will take the UML diagrams saved/exported from Dia and convert them into skeleton C# or VB.NET code.
If you're prepared to look at a more "general purpose" code generator, this page:
Generators that build VB.NET
will give you a good starting list of tools that will generate VB.NET code.

calculus engine in vb?

is there an easy to use library or engine for .NET that does calculus?
I posted an early version of some code I used in one of my classes in an answer to this thread:
Generated methods for polynomial evaluation (my answer includes classes for symbolic differentiation)
If I know exactly what you're looking for, I could try to post an updated version.
Google is suggesting you look through Wikipedia's list of free libraries that can do automatic differentiation, and see if any have a .NET or COM wrapper. EDIT: High-Performance Mark has pointed out that it appears you need symbolic differentiation, in which case these libraries won't help.
If you are keen, you possibly could create a .NET wrapper for one of the C++ libraries.

3d files in vb.net

I know this will be a difficult question, so I am not necessarily looking for a direct answer but maybe a tutorial or a point in the right direction.
What I am doing is programing a robot that will be controlled by a remote operator. We have a 3D rendering of the robot in SolidWorks. What I am looking to do is get the 3D file into VB (probably using DX9) and be able to manipulate it using code so that the remote operator will have a better idea of what the robot is doing. The operator will also have live video to look at, but that doesn't really matter for this question.
Any help would be greatly appreciated. Thanks!
Sounds like a tough idea to implement. Well, for VB you are stuck with MDX 1.1(Comes with DirectX SDK) or SlimDX (or other 3rd party Managed DirectX wrapper). The latest XNA (replacement for MDX 1.1/2.0b) is only available for C# coder. You can try some workaround but it's not recommended and you won't get much community support. These are the least you need to get your VB to display some 3d stuffs.
If you want to save some trouble, you could use ready made game engine to simplified you job. Try Ogre, and it's managed wrapper MOgre. It was one of the candidate for my project. But I ended up with SlimDX due to Ogre not supporting video very well. But since video is not your requirement, you can really consider it. Most sample would be in C# also, so you need to convert to VB.Net to use. It won't be hard.
Here comes the harder part, you need to export your model exported from SolidWorks to DirectX Format (*.x). I did a quick search in google and only found a few paid tools to do that. You might need to spend a bit on that or spend more time looking for free converter tools.
That's about it. If you have more question, post again. Good Luck
I'm not sure what the real question is but what I suspect that you are trying to do is to be able to manipulate a SW model of a robot with some sort of a manual input. Assuming that this is the correct question, there are two aspects that need to be dwelt with:
1) The Solidworks module: Once the model of the robot is working properly in SW, a program can be written in VB.Net that can manipulate the positional mates for each of the joints. Also using VB, a window can be programmed with slide bars etc. that will allow the operator to be able to "remotely" control the robot. Once this is done, there is a great opportunity to setup a table that could store the sequencial steps. When completed, the VB program could be further developed to allow the robot to "cycle" through a sequence of moves. If any obstacles are also added to the model, this would be a great tool for collission detection and training off line.
2) If the question also includes the incorporation of a physical operator pendent there are a number of potential solutions for this. It would be hoped that the robot software would provide a VB library for communicating and commanding the Robot programatically. If this is the case, then the VB code could then be developed with a "run" mode where the SW robot is controlled by the operator pendent, instead of the controls in the VB window, (as mentioned above). This would then allow the opertor to work "offline" with a virtual robot.
Hope this helps.