How to export optimization model in ojalgo - optimization

I build up a optimization model in ojalgo (ExpressionsBasedModel). Is there a way to export it to check the model? So far I am only able to export the lower and upper limits of variables and constraints but I am not able to export the variable's coefficients of constraints. I checked the available functions but I coudn't find an appropriate one. Only importing an MPS file I could find. Has someone a hint how to export the model without using an extra framework/external libraries?

There is no way to generate/export an MPS file using ojAlgo.
If you want to verify solver results with some 3:d party solver, you can do that. I believe the community (free) version of cplex allows up to 1000 variables and constraints.
https://github.com/optimatika/ojAlgo-extensions/tree/master/ojAlgo-cplex

Related

How to compute additional statistics in Evaluator?

In the TFX Evaluator, on top of the metrics described in TFMA format,I would like to compute statistics relative to the performance of my model on my dataset. Naturally, I would also like a way to get access to these statistics: either through the output of the component, or by letting the component upload the statistics somewhere.
I guess that some amount of custom code would be needed (both for the computation and the return of the statistics), but I don't really know how much and what would be the best way to write it. Any ideas on the topic ?
Thanks
There are 2 methods that you can achieve this depending on how you see the placement of your functionality in the TFX flow.
Writing a Custom TFX Components - which requires a lot of effort and you need to define quite a few things.
Reusing Existing Components - instead of writing a component for TFX entirely from scratch, we can inherit an existing component and customize it by overwriting the executor functionality.
I would suggest the following blogs to begin with:
Anatomy of TFX Component
Creating custom Components

irreducible infeasible set (IIS) in gurobi, from minizinc

Is there a way to get the IIS from Gurobi if I use it via the minizinc interface (i.e., mzn-gurobi) ?
Thanks,
Ofer
Currently no such option exists for mzn-gurobi. All available options can be seen by checking the help output: mzn-gurobi -h. Generally the options are for linear solvers (CBC, CPLEX, Gurobi) are shared. If you are missing this functionality, I would suggest making a feature request on the MiniZinc repository. (Note that this functionality wouldn't be able to point to the constraints in the MiniZinc model, only the generated FlatZinc constraints)
What is in development within MiniZinc are Minimal Unsatisfiable Sets, which in my understanding are the same. A special kind of MiniZinc solver is in development that will give a subset of constraints, in MiniZinc, that violate a model. Although it seems development is going strong, it might be a while before this program will be released. If you have an immediate need for such a tool, you can try contacting the MiniZinc Team.

Does TensorFlow support to save the initial hyper-parameter configuration automatically?

We need to run the designed networks many times for better performance and it would be better to record our experiments we have run. Maybe it could be good to provide to record these hyper-parameter configuration automatically by the tensorflow execution engine. For example, I record by set different directory name for the log directory as:
log_lr_0.001_theta_0.1_alpha_0.1
log_lr_0.01_theta_0.01_alpha_0.02
....
Are there any automatic ways to help this? In addition, it would be better that when we start a new tensorflow training instance, a new port will be allocated and a new tensorboard is started and shows its learning state.
No, tensorflow doesn't support initial hyper parameter configuration automatically.
I've faced the same issue as you, and I'm using a tool called Sacred, I hope you'd find that useful.

What Tensorflow API to use for Seq2Seq

This year Google produced 5 different packages for seq2seq:
seq2seq (claimed to be general purpose but
inactive)
nmt (active but supposed to be just
about NMT probably)
legacy_seq2seq
(clearly legacy)
contrib/seq2seq
(not complete probably)
tensor2tensor (similar purpose, also
active development)
Which package is actually worth to use for the implementation? It seems they are all different approaches but none of them stable enough.
I've had too a headache about some issue, which framework to choose? I want to implement OCR using Encoder-Decoder with attention. I've been trying to implement it using legacy_seq2seq (it was main library that time), but it was hard to understand all that process, for sure it should not be used any more.
https://github.com/google/seq2seq: for me it looks like trying to making a command line training script with not writing own code. If you want to learn Translation model, this should work but in other case it may not (like for my OCR), because there is not enough of documentation and too little number of users
https://github.com/tensorflow/tensor2tensor: this is very similar to above implementation but it is maintained and you can add more of own code for ex. reading own dataset. The basic usage is again Translation. But it also enable such task like Image Caption, which is nice. So if you want to try ready to use library and your problem is txt->txt or image->txt then you could try this. It should also work for OCR. I'm just not sure it there is enough documentation for each case (like using CNN at feature extractor)
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/seq2seq: apart from above, this is just pure library, which can be useful when you want to create a seq2seq by yourself using TF. It have a function to add Attention, Sequence Loss etc. In my case I chose that option as then I have much more freedom of choosing the each step of framework. I can choose CNN architecture, RNN cell type, Bi or Uni RNN, type of decoder etc. But then you will need to spend some time to get familiar with all the idea behind it.
https://github.com/tensorflow/nmt : another translation framework, based on tf.contrib.seq2seq library
From my perspective you have two option:
If you want to check the idea very fast and be sure that you are using very efficient code, use tensor2tensor library. It should help you to get early results or even very good final model.
If you want to make a research, not being sure how exactly the pipeline should look like or want to learn about idea of seq2seq, use library from tf.contrib.seq2seq.

Robust regression in scilab

For the aim of a robust linear regression, i want to realize a M-Estimator with Geman-McLure loss function
The class of M-Estimators are presented in this document and Geman-McLure can be found at page 13.
To solve the minimization problem, Iteratively reweighted least squares is recommended. How can i implement this procedure in scilab? May i use optim?
From the site of the document you linked there are also some Matlab demo files available in a zip. There are two files in this zip that I think are important:
utvisToolbox/tutorials/lineTut/robustDemo.m
utvisToolbox/tutorials/lineTut/robustIteration.m
In the robustDemo.m file there is a implementation of the Robust M-estimation Algorithm.
To answer your question how to implement this in SciLab; You could start by converting these matlab files to scilab using mfile2sci. At least in the
sampleRobustObj and robustIteration functions, only basic Matlab stuff is used which should be convertible by mfile2sci.