Pyomo gams writer - pyomo

I have the following problem. I want to solve a number of MINLP's in the following manner:
Create .gms file using pyomo
Solve model on a server with the gams license and solver's like BARON and SCIP
Use the solution of the current MINLP for the next MINLP
Go to 1.
Now I have some questions:
What is the best way to read the solution of the previous MINLP (right now I'm reading the .dat file)
How can I change the default gams/mipstart option to a value of 3? (I tried: io_options['add_options']=['option gams/mipstart = 3;'] but didn't work)

I don't know anything about the Pyomo/GAMS link.
But the "gams/mipstart = 3" line should go into a GAMS/SCIP options file (probably scip.opt, see also https://www.gams.com/25.1/docs/UG_SolverUsage.html#BASIC_USAGE_SOLVER_OPTION_FILE) and you would need to tell Pyomo to tell GAMS to use this option file.

Related

How can I override core misc js in drupal 8

I have a problem with dialog in drupal 8, and I found a place that make me stuck.
There is a code in this file not work as my expected. Please see the image
I just want to do the simple thing is comment the line out like below:
I can't do this because this is core file. So I want to override this file or this function only.
I trying to use libraries-override but no hope. This is my code, I am newbie so this code may have mistake or wrong.
"capital" is my theme, not module
below is my theme structure:
Please help... I googled this issue for long time.
Better way would be:
libraries-override:
core/drupal.dialog: captial/dialog
I have solved it by myself:
Step 1: clone core js to your theme js like this:
Step 2: modify template library ([your-theme-name].libraries.yml)
Declare core file your need to add to your theme
Step 3: disable core files using your theme info file ([your-theme-name].info.yml) and add your files as library:
That's it :)
Any better idea? please suggest me more.

How to specify GAMS solver-specific options through Pyomo?

I am trying to solve an MINLP problem with the ANTIGONE solver (licensed in GAMS), and I am having difficulties to change the advanced settings of the solver.
First, I call the solver from Pyomo as follows.
solver = pe.SolverFactory('gams')
solver.options['mtype']= "minlp"
solution = solver.solve(model, solver = 'antigone')
This part works as it should, however ANTIGONE cannot close the optimality gap, so I'd like to change some of the more advanced options that are provided here https://www.gams.com/latest/docs/S_ANTIGONE.html.
So what I first tried was to change the solver call to the following line.
solution = solver.solve(model, solver='antigone', add_options=['option number_of_partitions 2;'])
However, it looks like add_options is only for the built-in GAMS options, and not for the solver-specific ones.
As a side note, when using these advanced solver options in GAMS, the standard procedure is to create an options file (i.e. antigone.opt), where we specify the desired options.
number_of_partitions 2
antigone.opt is saved under the same directory, and the .gms file calls this file with the GAMS_MODEL.optfile; line.
Going back to my issue, when modifying this option from Pyomo, I tried
solution = solver.solve(model, solver='antigone', add_options=['GAMS_MODEL.optfile;'])
but the problem is that Pyomo creates a temporary file to solve the problem, and hence I cannot add the file antigone.opt before it starts solving.
Therefore, I can see two options to go: (i) I can find a way to create the antigone.opt file in the temporary file through Pyomo before the solver starts solving (less desirable, but it should work), or (ii) I should directly change the option from Pyomo (preferred).
Any help would be much appreciated and thanks in advance for your time!
Maybe this answer arrives a little late for you however I think this might help other people.
I had the same issue you had. After a long crusade and by putting many Stack Overflow posts together, I finally made it work using Pyomo only.
The line,
solution = solver.solve(model, solver='antigone', add_options = ['GAMS_MODEL.optfile;'])
should be replaced by,
solution = solver.solve(model, solver='antigone', add_options = ['GAMS_MODEL.optfile = 1;','$onecho > antigone.opt', 'number_of_partitions 2', '$offecho'])
So the first option specifies the use of the antigone.opt file and the remaining lines tell GAMS to create and write in the antigone.opt file.
I had a similar problem when using pyomo->gams->knitro. The code below worked for me. My code was in /Users/myDir/, and I created the directory "tmp" there. Then I instruct pyomo to use that and the file knitro.opt is placed there.
opt = SolverFactory('gams')
opts = {}
opts["solver"] = "knitro"
with open("tmp/knitro.opt", "w") as f:
f.write("algorithm 2\n")
addOp = ['GAMS_MODEL.optfile=1;']
opt.solve(instance, io_options=opts, load_solutions=True, tee=True,
add_options=addOp, tmpdir='/Users/myDir/tmp')

Power BI Desktop - How to change data source?

When I'm trying to change my existing data source (Microsoft Azure CosmosDB) to Blob Storage, the Change source is disabled. How do I workaround this?
I have gone through various questions but none of them were similar to mine.
Any help is much appreciated.
Thanks
Workaround
Click on edit queries
Select the query
Advanced Editor
You can change the datasource from here.
Then do apply , export if necessary
Like #rinjan stated above go to the advanced editor on your table in the query editor. Then you will get something like this (This is an Excel connection):
let
Source = Folder.Files("J:\TestPath"),
#"J:\TestPath\Map1 xlsx" = Source{[#"Folder Path"="J:\TestPath\",Name="Map1.xlsx"]}[Content],
#"Imported Excel" = Excel.Workbook(#"J:\TestPath\Map1 xlsx"),
Map1_Sheet = #"Imported Excel"{[Item="Map1",Kind="Sheet"]}[Data],
....and so on
Best way to go here is to copy paste the whole text into the text editor and chose the option replace all with the following line (for this example):
Old value: J:\TestPath
New value: J:\New\Path
If it is not working you have to inspect the lines of codes. Maybe you find the missing piece.
The first line of every table must be Source:
https://community.powerbi.com/t5/Community-Blog/Why-can-t-I-change-the-Data-Source-in-Power-BI-disabled-button/ba-p/915365

How can I give a custom file names to a code file in ideone.com?

I am using ideone as online c++ compiler. When I save a code, ideone gives a random name such as
lnzr40
which might be confusing later on (when I want to open a specific code). I want to change that name or give a custom name at the time of writing/saving the code. How can I do that?
Edit: Labeling or creating custom links may be slightly useful but they are not what I need exactly! I need to modify the file name.
Thanks!
I am no ideone power-user, but there does not seem to be any simple way to change the name of a source code file.
However, there is a note field immediately to the right of the file name in the list of files. You could use this field to enter the appropriate file name:
This seems to be a case where a link-only answer is appropriate ;)
http://tinyurl.com/Yes-it-is-possible

Is it possible to edit tag of a file programatically using c++

I want to add/edit the tag of a file programatically using c++.But after seraching for almost 2 days I found nothing.Could you kindly help me whether we can add/edit the tag of a file using c++?
Thanks in advance.
Edit 1:
I want to edit the OS level tag on file/directory.Eg:Each file has its own properties like Title,Subject,Categories and one among this is tags.I want to edit/add the property "Tags".
Thanks tony for suggestion.
Regards,
Ravi
Here's a detailed example about how to access the property values of a file:
http://support.microsoft.com/kb/186898
Here's a shorter example that shows how to write property values:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa380387(v=vs.85).aspx
I don't know about the property Tags (I haven't seen it anywhere), but as you see, it basically is possible to manipulate properties of NTFS files.