只是我或Cplex Concert API可以使用一些改进吗? [英] Is it just me or could the Cplex Concert API use some improvements?

查看:236
本文介绍了只是我或Cplex Concert API可以使用一些改进吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

附录:我认识到这个帖子似乎是以一种ran the的形式出现的,但是如果你能纠正任何误会,澄清一切,还是更好一点:帮助我解决我的问题与迭代器问题,我会很感激!我正在使用cplex 9(我知道这不是最新的,这不在我手中)。



只是我或CPLEX Concert API可以使用一些改进?说这个很有意思的话会在我目前的意见中表现出来,因为它似乎违反了我曾经遇到过的高质量C ++ API设计的所有惯例。



注意事项:




  • const setter方法

  • operator []返回参考句柄对象而不是引用


  • 没有数组迭代器(即使迭代器对于并行编程并不好,在我看来仍然可以使用不太关键的代码)

  • 极端开发者对STL用户的敌意,希望混合两者(或者如果不是STL,至少代码本身已经是STL兼容的,像Boost)。


    • 示例:在数组类中不是一个typedef,甚至(绝对最低)绝对最小)value_type。




我做了一个数组包装器,很简单。我做过的迭代器包装器,不是那么多。由于前两点,迭代器(当前)会导致编译时不应该的代码!我还在试图找到一个方法(我使用boost.iterator_facade)。



不要误会我,我明白权衡需要在设计API时要做。我相当清楚,API旨在简化手册(隐藏与我想象的用户的语言相关的注意事项)。然而,在这样做的同时,虽然可能简化了C ++ API的设计,但是它使我的代码写入更加复杂和耗时,以弥补我目前认为是设计错误。



在罗马,做罗马人!



我很乐意听到他们关于这些观点的设计决策的理由。 >

编辑:我已经设法让我的Iterator类工作,在处理中消除了与cplex对象中的迭代器相关的使用方面的许多角色可用性和正确性缺陷以一些性能为代价(克隆可解压缩文件,从const_iterator返回之前)。离开(我相信)只剩下第一个显着的缺陷,如果在cplex api中每个受影响的类型都没有额外的间接层次,就无法纠正。不用担心,我只需要小心呼叫的频率取消引用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
  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆