I am solving a MIP in IBM ILOG CPLEX Optimization Studio. I would like to first generate a solution where the main decision variables need not be integers, which will then be used as a starting solution to solve the model where the decision variables should be integers.
What should I type in my .mod file to obtain this?
Thank you!
You will probably need to use a main() function to control the sequence of solves. This can be done either all in one .mod file or with the main() in a separate .mod file that controls the process of using/solving the others. This is described in the documentation. There are examples in the OPL samples folder; see mulprod or LangrangianRelaxation. Give it a go, and when you have something concrete that doesn't work, come back and ask again.
Related
I would like to write a presolved problem into a file. Is there any way to do it?
write problem does not do it for me, it gives me the original problem that I read with SCIP.
The context is that I am working on SAT problems. The presolving phase of SCIP reduces the number of constraints and variables of the problem, effectively making the problem a little smaller. I would like to take a look at the presolved problem and compare it with the original problem and make some observations.
Yes, it is very easy, just use write transproblem.
The SCIP interactive shell also tells you all the possible commands that you can use, e.g. if you just type write in the SCIP shell, you see all available write commands
I've implemented my problem in IBM ILOG CPLEX Optimization Studio.
Now i would like to modify the objective function to be quadratic and solve the problem. However, it shows an Error 5002:objective is not convex.->problem can be solved to global optimality with solution target 3->.
I have read the user guide and manual and the different topics in stackoverflow, and I beleive version 12.8 can solve mixed-integer quadratic problems.
modify my objective from this
dexpr float overallcost[f in cars] = holdingTime[f];
to this
dexpr float overallcost[f in cars] = holdTime[f]*holdTime[f];
Error 5002:objective is not convex.->problem can be solved to global optimality with solution target 3->.
As suggested by the error message you should try setting the solution target parameter to 3 to force CPLEX to solve your model.
More details about this can be found in this chapter of the user manual and here is the documentation of the respective parameter.
To set this parameter in the IDE create/add a settings file to your project and then go to
Mathematical Programming -> General -> Type of solution to compute
and choose "Global optimal solution".
See
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/OptimalityTarget.html
In order to set that parameter in order to solve quadratic objectives.
In your model, you may add:
execute
{
cplex.optimalitytarget=3;
}
I want to find my mistake in GAMS model. I don't have any errors , but my model doesn't work well
Is there any debugging tools in GAMS ?( like debugger tools in other software, e.g MATLAB)
Best
Unfortunately, I have not come across any.
If you have no errors in GAMS, it rather points to a modelling problem rather than a GAMS one. GAMS is like any other programming/modelling software, what you put in is what you get out. However, there are some commands and some intuitive ways you can find out the problem with your model:
One common way is by using the display and $stop commands. If you have loops within your GAMS code, it is best to track the progress of the loop by displaying some key variables either to your .lst file or using put utility (also a nice tool). I use the put utility, and write the code to display key variables at each point of my code to identify where things may have gone wrong.
The $stop command terminates your GAMS code at the line in which it is written.
Hope this helps.
This might be a quite basic question, however, I did not find any suggestions so far.
I am running the Scip Opt Suite on OSX and everything runs well so far. No I wanted to start to model my first mathematical problem in zimpl, however I do not know how to start.
However, in the user's guide there is just prescribed how to load existing zpl-files, but not how to create on files.
Do you have any suggestions or any further threads dealing with that task?
Kind Regards
In the zimpl package root, there's an example directory. The .zpl files in example are a great starting point for writing your own zimpl inputs. Also, zimpl's author wrote this pdf that walks through the process of writing a formulation to solve a Sudoku puzzle using zimpl.
I am looking for a tool that can (automatically) create class diagrams like this one from Modelica code:
https://trac.modelica.org/Modelica/attachment/ticket/85/classDiagramModelicaMedia.png
I need to create a couple of such diagrams and an automated solution would help a lot!
So far, I found this article about Modelica CDV (class diagram viewer):
https://www.modelica.org/events/modelica2006/Proceedings/sessions/Session1c1.pdf
but not a ready to use tool. Any ideas?
This can be done with SystemModeler and Mathematica. The relevant function is a little bit hidden, but it's there. Here's an example:
WSMLink`Library`WSMDependencyGraph["Modelica.Mechanics.Rotational.Components.Spring"]
When hovering over the classes, the full name appears:
The object returned from the function includes a Graph, so you can operate on it with all the graph functionality in Mathematica. Also the function takes the same arguments as Graph, so you can get different graph layouts if needed.
I don't have any specific suggestions, but you might find that a tool like OpenModelica could extract and output sufficient information to construct such diagrams. It seems to have many command line switches for outputting lots of information (debugging and otherwise).