它只是我或者可以的Cplex Concert API使用一些改进? [英] Is it just me or could the Cplex Concert API use some improvements?
问题描述
附录:我意识到这个帖子似乎是一个rant的形式,但如果你可以纠正任何误解,我有,澄清什么,或更好:帮助我解决我的问题迭代器问题,我会非常感激!我目前使用的是cplex 9(我知道这不是最新的,它是我的手)。
这只是我或者CPLEX Concert API可以使用一些改进?表示它有很多需要的将是好评于我目前的意见,因为它似乎违反了我已经遇到的质量C ++ API设计的每一个既定的做法。
值得注意的是:
- const setter方法
- 对象而不是引用
- 没有数组迭代器(即使迭代器不是对于并行编程来说,在我看来,它仍然可以被较不重要的代码使用)
- 极限开发者对STL的用户希望混合两个如果不是STL,至少代码本身已经是STL兼容的,像Boost)。
- 示例:在数组类中不是单个typedef,不是偶数(最小和绝对最小)value_type。
我做了一个数组封装,很容易。我做了一个迭代器封装,而不是这么多。因为前两个点,迭代器(当前)导致代码编译时,它不应该!我仍然试图找到一个方法(我使用boost.iterator_facade)。
不要误会我,我明白权衡需要在设计API时。对我来说很清楚,API旨在简化手册(隐藏与用户相关的语言相关注意事项)。这样做虽然可能简化了C ++ API的设计,但是它使我的代码编写更加复杂和耗时,以弥补我目前认为的设计错误。
在罗马,做罗马人!
我很乐意听到他们关于这些点的设计决定的理由。
编辑:我已经设法让我的Iterator类工作,在处理中消除了与cplex对象中的迭代器的使用相关的许多角落可用性和正确性缺陷 - 通过设计,我可以,代价一些性能(克隆提取之前,从一个const_iterator返回)。离开(我相信)只有第一个显着的缺陷,如果没有一个额外的间接的周围环绕每个受影响的类型在cplex api不能被纠正..不,谢谢,我只需要小心呼叫的频率dereferencing IloExtractable派生类型的const_iterators。
不,这将帮助你,但我不能相信改进,从CPLEX 9到12,它制定了使用,因为12是免费的学术用途。
Addendum: I realize this post appears to take the form of a rant, but if you could correct any misunderstandings I have, clarify anything, or better yet: help me solve my problem with the iterator issue, I'd be very grateful! I'm currently using cplex 9 (I know it's not the latest, it's out of my hands).
Is it just me or could the CPLEX Concert API use some improvement? Saying that it leaves much to be desired would be putting it kindly in my current opinion, as it seems to violate just about every established practice for quality C++ API design that I've ever come across.
Notables:
- const setter methods
- operator[] returning reference handle objects instead of references
- operator[] const returns reference handles that aren't const, leading to potential errors.
- no array iterators (even though iterators aren't great for parallel programming, it should still be available for use by less critical code in my opinion)
- extreme developer-hostility for users of the STL who wish to mix the two (or if not the STL, at least code that is itself already STL-compatible, like Boost).
- example: not a single typedef in the array classes, not even (at a bare and absolute minimum) value_type.
I made an array wrapper, that was easy. An iterator wrapper I've made, not so much. Because of the first two points, the iterator (currently) results in code that compiles when it shouldn't! I'm still trying to find a way around it (I'm using boost.iterator_facade).
Don't get me wrong, I understand that trade-offs need to be made when designing an API. It's fairly clear to me that the API was designed to simplify the manuals (hiding language-dependent considerations from the user I imagine). In doing so however, while it may have simplified the designing of the C++ API, it has made my code-writing more complex and time-consuming to make up for what I currently deem to be design errors.
When in Rome, do as the romans!
I would LOVE to hear the rationale for their design decisions concerning these points.
Edit: I've managed to get my Iterator class to work, in the processing eliminating as many of the corner-case usability and correctness flaws with respect to usage through iterators in cplex's object-passing design as I could, at the cost of some performance (cloning extractables before returning them from a const_iterator). leaving (I believe) only the first notable flaw remaining which can't be corrected without an extra layer of indirection around every affected type in the cplex api.. no thanks, I'll just have to be careful of the frequency of calls when dereferencing const_iterators of IloExtractable-derived types.
Not that this will help you much but I could not believe the improvements when I switched from CPLEX 9 to 12, it worked out for use since 12 is free for academic use.
这篇关于它只是我或者可以的Cplex Concert API使用一些改进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!