FET Forum

FET Support (English) => Get Help => Topic started by: thanhnambkhn on November 03, 2016, 04:41:23 AM

Title: Customize Fet command line output
Post by: thanhnambkhn on November 03, 2016, 04:41:23 AM
Dear all,
Did any body try to customize Fet-cl Source in order to:
- get output result in other format (such as json)
- add more information to output result. (I saw that FET (with GUI) gives the result is more fully than FET-cl).

Dear Lalescu Liviu,
Can you help me to do that? Thank you so much!



Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 03, 2016, 06:35:46 AM
Please see file src/interface/fet.cpp, lines 793-1381, for the beginning.
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 03, 2016, 08:09:44 AM
Thank you. I am investigating it :)

I have an other question.
In Fet GUI/ Timetable Tab/ there is "Soft Conflicts" functionality. (available after generating).
There are some information such as "Number of broken soft constraints: 1 . Total soft conflicts: 0.95 ..."

How to get that information from FET command line?
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 03, 2016, 10:30:39 AM
See src/engine/timetableexport.cpp, lines 1693-1751.
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 07, 2016, 07:27:38 AM
Thank Liviu Lalescu,
Follow your guide, now I can get "Soft Conflicts" from command line.

Could I have an other question?  :)
How can I make command line have output, which are equivalent to FET with GUI: (on generate Timetable window dialog)
- "Without stopping the simulation and View initial order of placing the activities?"
- "Without stopping the simulation and View difficulty activities?"
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 07, 2016, 11:36:38 AM
Sure, no problem :)

The initial order is visible always (from the beginning) in the "logs" directory of the results.

For writing the difficult activities: see generate.cpp, lines 2964-2970. You need to connect this code to a command-line signal (SIGTERM is taken, but you may change that). See also timetablegenerateform.cpp function seeImpossible(), and fet.cpp lines 154-165 and 1202-1203. Since command-line is not threaded (no mutex), you need to ensure that you are showing the difficult activities correctly: completely before or completely after the lines 2964-2970 in generate.cpp.
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 13, 2016, 11:49:35 PM
Dear Liviu,
On Fet command line, how to enable the constraints which are locked by dèault ( constraint with lock icon)
(In Fet Gui, I can go to settings to unlock them.)

Thank you, have a nice week.
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 17, 2016, 02:59:27 AM
Hi Liviu,

I found that there are some differences in output result between Fet-cl and Fet-gui.
Fet-gui gives us more detail information than Fet-cl.

Let 's start with the input data TKB_191.fet which I attached below.
FET-gui gives us full detail information:
- Message box with detail about "Generate Impossible": [i]"Simulation impossible! Maybe you can consider lowering the constraints. The partial results were saved in the directory C:\Users\nxan\fet-results\timetables\TKB_191-single

Additional information relating impossible to schedule activities:

Please check the constraints related to the activity below, which might be impossible to schedule:

No: 1, Id: 46 (T:600924108, S:Chào cờ, AT:Sáng, St:1G - Sáng)"[/i]


- Fet-gui also generates "TKB_191_single" folder in output folder (include soft_conflict.txt ...)

But with FET-cl, it gives us very short output, "Impossible generate" only, with return value is 0.
When I checked the output folder, there is not any folder such as: "TKB_191_single" or something like that. (to get more detail about "impossible generate")

So, my question is: how to make FET-cl also generate TKB_191_single folder and soft_conflict.txt file.

Thank you.
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 17, 2016, 11:48:55 AM
See fet.cpp, lines 1232-1235. In case of impossible activity, I did not consider necessary to write the partial timetable or more information. Because you have the initial order of placing the activities and the max placed number of activities. Just look at the next activity - this is the difficult activity. If you really need to get the partial timetables and the conflicts.txt, you could change the sources, like in timetablegenerateform, function TimetableGenerateForm::impossibleToSolve(), but without the threading stuff.

Do you think I should change the official sources?
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 17, 2016, 03:23:38 PM
I made this for the official FET, thanks for suggesting! :)

Please use the attached file until the new version will be out.
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 17, 2016, 07:20:24 PM
I added a new snapshot, containing a FET with this improvement (see the Snapshots section or, after I will release FET-5.30.6, in the official FET).

Please test and let me know if now it is OK.
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 25, 2016, 07:13:25 AM
Dear Liviu,

I have tested, FET works like charm.
Thank you so much for your support.

I will try to give more useful suggestions.
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 25, 2016, 07:26:32 AM
Good, thank you for your feed-back :)
Title: Re: Customize Fet command line output
Post by: thanhnambkhn on November 30, 2016, 02:49:00 AM
Dear Liviu,

I am going to add "multiple - generate" (which is on FET-desktop only) to FET-cl because I think this functionality is very useful.

Please help me? Thanks.
Title: Re: Customize Fet command line output
Post by: Volker Dirr on November 30, 2016, 12:00:11 PM
multiple is just starting a new generation after one is done. so just write a for-command in your batch file and start fet-cl x times.
Title: Re: Customize Fet command line output
Post by: Liviu Lalescu on November 30, 2016, 12:04:48 PM
Yes, or start in parallel (if you have more cores), but in this case (or even in Volker's variant) don't forget to check/change the random seed at start, to be different for each timetable. If you start two timetables in the same second, the random seed will be the same. So you need to set it different.